4 ms·
I'm not such a fan of how spread out everything is. I'd really like to see html, js, and css all together in one place. React is the best I've seen, but it does
by superbaconman 8y ago
I'm not such a fan of how spread out everything is. I'd really like to see html, js, and css all together in one place. React is the best I've seen, but it doesn't provide a good solution for css.
- spankalee 8y agoCheck out LitElement. It lets you define everything in one place, and because it uses Shadow DOM, CSS is handled as well. Here's where we'll be with plain standard JavaScript once class fields and decorators land: import {LitElement, html, property, customElement} from '@polymer/lit-element'; @customElement('hello-element') class HelloElement extends LitElement { @property() name = 'World'; render() { return html` <style> :host { display: block; background: blue; } h1 { color: white; // scoped to the ShadowRoot } </style> <h1>Hello ${this.name}!</h1> `; } }
- marcosdumay 8y ago> I'd really like to see html, js, and css all together in one place. You mean like Vue components? I think HTML components go on the same line, although this article does not emphasizes this.
- cageface 8y agoTry styled-components: https://www.styled-components.com/ https://www.styled-components.com/ Makes handling CSS in react a pleasure.