3 ms·
Is React worth it? How complex does your site need to be before it becomes worthwhile?
by smegel 10y ago
Is React worth it? How complex does your site need to be before it becomes worthwhile?
- cgag 10y agoReact is pretty easy to start with, for me the question is when does redux and the madness in redux starter kit become worth it.
- danenania 10y agoYeah, I can see the value in redux for a big app with lots of complex state to manage (eg Facebook), but it seems like major overkill in a lot of smaller apps where people seem to be reaching for it by default for some reason. Plain React components and a few helper modules can get you a surprisingly long way--there's really no need for more framework until deeply nested components make simple argument passing unweildy.
- firasd 10y agoI saw this from Redux's creator that aligns with my take: "When people say setState() is an anti-pattern, they mean 500-line components with a complex setState() soup scattered across event handlers. When you spend your days looking for bugs in those handlers and moving them up and down component hierarchy, consider extracting it." https://twitter.com/dan_abramov/status/725090047557558272 https://twitter.com/dan_abramov/status/725090047557558272 I had that whole 'moving values and events up and down the component hierarchy, driving me nuts' thing going on when I tried to make an editor page for a two-level list. I added Redux and now I just directly read/update the list in the store from every component in the editor.
- jrochkind1 10y agoHas anyone done anything non-trivial with [MobX](https://github.com/mobxjs/mobx https://github.com/mobxjs/mobx) as an alternative to redux/flux with react? I'm curious how that ends up working out. It is intriguing and enticing to me, because I have had similar experiences that the most 'challenging' part of using react is the flux part not the actual react part. But I'm just a react newbie, and based on my experience so far, am scared to go 'off the common path' at all because it tends to end up being a royal mess for reasons I didn't have the experience to predict in advance. :)
- pumblechook 10y agoI faced this same question on a recent small project. For anyone dipping their toes into React, it's a huge leap of complexity. I thought I could jump into Flux just like React: get familiar with the concepts, do a tutorial or two, and start building. Nope. I looked into Redux, but quickly realized it was overkill for my simple project. I eventually settled on Reflux, and I would highly recommend it for those who are just getting started with Flux.
- amasad 10y agoReusability is React's real value prop IMO. Other libraries and frameworks may give you the illusion of good encapsulation and composeablity but in reality it breaks down once something changes. If you have a lot of same or similar views in your app used in different contexts then React becomes worth it really quickly.
- BWStearns 10y agoI've only played with react wrapped in reagent (cljs), but seeing the underlying code here, I feel comfortable saying you can benefit from this pattern relatively early. Just having the virtual dom/view-as-projection-of-state concept saves you a lot of mental overhead about state management. If you're going to build an SPA and you're not already totally sold on yourFavoriteJSFramework, give react a try. I've actually found working with react/reagent to be substantially simpler to reason about, and lower complexity pays dividends far before any performance or scalability gains do (though I hear react is quite good in that respect as well).
- Drdrdrq 10y agoFor those of us who don't know it yet: SPA == Single page (web) application [0] [0] https://en.m.wikipedia.org/wiki/Single-page_application https://en.m.wikipedia.org/wiki/Single-page_application
- ng12 10y agoReact is worthwhile no matter how small it is. Flux/Redux is the question. Thinking in those is much more difficult.
- coldtea 10y agoIf what you have is a "site" (e.g. online newspaper, blog, brochure-ware etc.) don't bother. If it's a web app, though, consider it, if you have lots of forms, controls, changing parts etc. (If you only have a few simple forms, e.g. a shopping cart + "buy" buttons, you won't really need it either).
- nojvek 10y agoI'd love to hear what things you find complicated. I hear you though. Vue has a great abstraction. Although it does too much magic and quite slow at times.