DEV Community

loading...

Discussion on: Separating front end styling and development

Collapse
guidovizoso profile image
Guido Vizoso

Speaking for myself here: React and styled-components allows us to have such a level of componentization (is that a word?) that I tend to mix styles and logic on the same file. Components are so small and atomic that adding some styling won't collide with the logic of the app. In case some component breaks it's easy to identify and fix without breaking anything else.

Hope it helps!

Collapse
jeastham1993 profile image
James Eastham Author

Thanks for the response Guido. I'm currently in the middle of a React training course and that seems to allude towards keeping a small number of stateful components that control logic and having a lot more stateless dumb/presentation components.

I think that fits with what you're saying if I've understood correctly?

Collapse
guidovizoso profile image
Guido Vizoso

You got it perfectly! I have some "smart" components (with state, GraphQL queries, logic, etc) that act as a motherboard and a bunch of stateless components that would be switches and led lights which the user would interact with to control the motherboard.

Thread Thread
jeastham1993 profile image
James Eastham Author

Great analogy! Thanks for the input Guido, I really appreciate it.