4 ms·
As is covered ad naseum else where, ReactJS is just a way to do Views. What did you use to manage state, data flow, communication to servers, etc?
by balls187 12y ago
As is covered ad naseum else where, ReactJS is just a way to do Views.
What did you use to manage state, data flow, communication to servers, etc?
- woah 12y agoYou can actually do a lot of that stuff with JavaScript, it turns out.
- EugeneOZ 12y agoyeah, let's be cool guys to the end and use VanillaJS only.
- balls187 12y agoSo you end up with an unmaintainable pile of javascript? Or are advocating reinventing the wheel and writing a bunch of boiler plate javascript to marshal data, update state, etc? ---- One major reason to use a JS framework is to enforce good design and coding practices to allow for more maintainable code. You can certainly implement these patterns yourself in Javascript, but you are reinventing the wheel, which is an antipattern in pretty much all but the edgiest cases.
- woah 12y agoReact abstracts away the stuff that usually makes JS complicated, like DOM manipulation, or dealing with observables. What you're left with is view components that you can just stick a regular JSON tree into. For instance, updating state is something that you don't really need to do in React. Just update your JSON tree, and your interface will match. And JS is really good at monkeying around with JSON. There is some stuff like routers etc. that you might not want to write yourself. Luckily there is a universe of components you can choose from, instead of one that some guy at google thought was good.
- dwg 12y agoUsed refluxjs for data flow. Inside the stores, superagent is used for request handling. React-router was used for routing.
- balls187 12y agoOnce I finally grok'd the implementations of Flux, I found the it to be a decent layer ontop of ReactJS. Of the implementations of Flux, Reflux is pretty good, with less hassle of a centralized dispatcher, and extra boilerplate. What I don't get is that the `trigger` is essentially a store created action, which goes against the unidirectional data flow model.
- dwg 12y agoI definitely found Reflux to be more understandable and easier to put into practice than Flux in general. They trade-off some purity and flexibility for simplicity. That said the stores and trigger method are definitely one of the rougher areas in the app. Thinking back, the stores were probably the largest source of bugs, but they also contain more logic so it's reasonable to assume they would have higher bug density. Reflux was a great stepping stone, but this is the area I would most like to refactor and/or spend more time on in future projects. Fortunately there's a lot of interesting work going on in this area right now.
- vuldin 12y agoIt's worth mentioning that this was not an issue the author even brought up, I assume since React doesn't claim to handle any of these other concerns in an application. Saying React doesn't handle these functions is like complaining about a screwdriver not being able to hammer a nail very well.
- balls187 12y agoIt's also worth noting that this sub-thread is in response to another commenter, not the original article.