3 ms·
no disagreement on what react is. yes, I understand react can be used just to template (no one uses it this way). yes, react is powerful. yes, react provides a
by platz 10y ago
no disagreement on what react is. yes, I understand react can be used just to template (no one uses it this way). yes, react is powerful. yes, react provides a good mechanism for handling state and events. what i am saying though is that for some apps, you can get by with simpler templating and avoid the conplexity/power react gives you, handling state and events yourself manually. does it sound crazy? if you know it will work for your particular use case, i dont think its crazy, and you avoid a bundle of complexity that react gives you, in essesnce you own the complexity now
- drdaeman 10y ago> react can be used just to template (no one uses it this way) I don't know about the others but I do. Got bad experience when I've shoved logic where it didn't belong, don't repeat the same mistake again. As the templating "got data, want a form, a table and a chart" engine it's good - exactly in a sense that I can write one template instead of multiple partials (add+update+remove). The complexity hidden underneath doesn't strike my fancy, but... it works, and saves coding time - especially because a lot of components are already written by someone else and is available on npm. Still, it's really really easy to shoot yourself in the leg. And I found a fair share of tutorials and examples teaching those sort of things. > react provides a good mechanism for handling state and events No, it doesn't have those. Unless you count react-router/Redux/Mobx/whatever as React-the-umbrella-naming. Well, there is some basic internal state management (via constructor + `setState` + `componentWillReceiveProps`) but that's about it, and IMHO it best very used conservatively, for approximately the same reasons why having logic in, say, Jinja2 templates isn't the best idea in Python world. Or maybe I just don't know how to cook stateful components properly, but last time I made a stateful component I ended up rewriting it some weeks later, extracting the state away, because it became a problem. There is no event handling at all - except for the "props are changing, this is going to update" event, of course. All React has is `onClick`-like attributes and handlers bound to those are best left as some dispatch calls to the outside, with no logic inside the React component code whatsoever.