4 ms·
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
by Jorge1o1 8y ago
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.
- ArrayList 8y agoI see what you're saying, but in your example that would just be input type="reset".
- konaraddio 8y agoReact 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 https://reactjs.org/docs/introducing-jsx.html#why-jsx