3 ms·
You don't need redux most of the time, let alone sagas. It's very common mistake. Mostly you can use `useState()` and just pass it with props. If you really ne
by hatch_q 5y ago
You don't need redux most of the time, let alone sagas. It's very common mistake. Mostly you can use `useState()` and just pass it with props.
If you really need reactive global state i'd prefer to use MobX.
- akvadrako 5y agoYou don't need MobX either – for global state you can just use useContext().
- datavirtue 5y agoClassic React. The subject of state comes up and a debate starts as the noobs squint at the screen. Pretty much the whole point of this thread/post. I started a significant project using React and tried for days to figure out how to handle state. After endless debate and conflicting advice online I felt I needed to speak with someone who has built a real world business app to explan how the fuck they pulled it off without pulling out their hair. (Still very curious but spooked enough to avoid sauntering onto a React project to find out.)
- qudat 5y agoThats because in the react world its all about state management. Once it clicks that the view is just a function of state then these discussions will make more sense.
- blacktriangle 5y agoThis is one of the statements I hear over and over from React devs that while technically true just glosses over the giant iceberg that is state management in React.
- atom_arranger 5y agoUse a networking library like relay, or react-query and 90% of your state management problems go away in most apps. Your state is on the DB, those libs handle fetching and caching it. Honorable mention, haven’t used it myself but there is RTK Query too, which is a library like those, but based on Redux, could be easier to debug.
- michaelcampbell 5y agoLots of articles from people that know more than I that recommend NOT doing this. If you need global state (and you may not, in fact you probably don't), then use a state manager. There are a lot for React; some more standard, some more simple.
- qudat 5y agoI see this sentiment all the time and some context is sorely needed because its a dangerous statement to make. Theres a reason why global state management is a thing and its not an edge case. For small projects where you want to prop drill is enough, fine. But we are talking about very small projects. Anything bigger and there is a significant drawback to that approach.