Re:Ask HN: Is all programming constantly changing or just fr...
by konaraddio on Monday April 01, 2019 @11:46PM
(#19550916)
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
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.