2 ms·
There is separations of concerns and separation of technologies. A component with its styling, markup structure, and behavior, is one concern. These components
by dsego 1y ago
There is separations of concerns and separation of technologies.
A component with its styling, markup structure, and behavior, is one concern. These components can than be combined and nested in every which way you need, they are very modular.
If you separate concerns into markup, styling, behavior, than this form of component-based reuse is difficult. But it could conceivably be easier to reuse an html template or css class for different features.
Hooks are also a way to separate concerns in a different way than lifecycle methods. Lifecycle methods group code by specific points in a component's life, but then the logic can't be extracted and reused. Hooks on the other hand encapsulate reusable logic that can then be used in different components.
- kqr 1y agoThank you for saying this so clearly. I find React to be one of the few systems that actually allow separation of concerns when used idiomatically, rather than drawing boundaries based on technologies. (And I dislike frontend programming, to be clear!) https://entropicthoughts.com/mvc-mistake https://entropicthoughts.com/mvc-mistake