Hacker News new | past | comments | ask | show | jobs | submit login

The beauty of React and other frameworks is that it separates the concerns of state and UI.

I don't see it as a tool for making a fancy button or widget, I see it as a tool for guaranteeing that what the user sees is always what's actually going on in the logic.

Too many times I've written something like a "clear" button or a "reset" button in jQuery, added an extra field, forgotten to include it in that clear/reset method and now the UI doesn't match the logic, leading to unpredictable and hard to debug results.




React separates concerns but it doesn't separate state and UI. It separates concerns through components but encourages tightly coupling relevant state and UI into components because a UI typically reflects changes in state (this is what JSX is for).

The "Why JSX?" on React's docs covers this with more detail: https://reactjs.org/docs/introducing-jsx.html#why-jsx




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

Search: