3 ms·
I agree totally. I have an app of a few hundred components and sometimes there's a lot of heavy business logic that feels wrong to have in a component. I also
by Waterluvian 10y ago
I agree totally.
I have an app of a few hundred components and sometimes there's a lot of heavy business logic that feels wrong to have in a component.
I also have this ugly mess of scss that don't live with the components.
What I'd like to see is a component gets to define it's own structure and default look and feel. So styles in the component. Then you can give it class information if you're giving it your own styling or customization.
I would love to be able to package an entire calendar widget, for example, into a module that is only .JSX files. And know that no matter where I import it, by default it'll look and behave in a sane manner.
- dexwiz 10y agoUsing classes as overrides is like how Bootstrap is (was?) customized. Bootstrap had default css classes that applied a default style. To override it, you would create your own css classes with custom attributes targeting the same classes, but with higher specificity [1]. You are still using styling here. Styling can get very verbose. That would just clog up the .JSX file. CSS will be its own entity from React or any templating engine for the foreseeable. Moving it into its own file helps with code organization. The only sane way to link them right now is css classes. Althought the argument for inline versus class css extends beyond the React world. But you have to do things like prefixing to make sure your css [1] https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity