Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In many cases that division doesn't exist. Part of the beauty of React, as far as I'm concerned, is that it allows us to think about things on the page in terms of components, rather than as separate blocks of html, and javascript.

It does make sense to bring css into the mix as well, as css can have functional effects. If you have a React component, for example, which explicitly toggles whether items are displayed or not, it makes sense to tie the toggling of the css display property directly into the component, rather than factoring it out into a separate stylesheet and creating an additional dependency.

Note that I'm not suggesting that all styling should be done this way - I think that would be disastrous - but that there is merit in composing the html, css and javascript together.



Exactly. It's still a separation of concerns, just a different set of concerns. Organizing my code by feature/component is so much easier on my brain than organizing it by file extension.

You can mess this up, of course. We are really good at making things more complex than they ought to be, especially while the ideas are fresh in our head. We just need to keep that in mind to :)


Is it not just making things more complicated to put some CSS separate and some at the component level? Sounds like a nightmare for a designer who comes in to the game that didn't design the app.

I'm not saying breaking CSS into separate files is a perfect solution (this is what I do), but at least it allows you to have everything in one place so anyone can pick up and customize.

I work with some pretty complicated enterprise CMS systems and they are already terrible complex. Last thing I want to do is start spreading CSS all over the app.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: