3 ms·
There are 45 comments so far and 7 references to "redux". I'm just gonna rep for the Recoil clones here and mention Jotai, which likely already works with React
by pixelsort 2y ago
There are 45 comments so far and 7 references to "redux". I'm just gonna rep for the Recoil clones here and mention Jotai, which likely already works with React 19 without any necessary changes.
With enough front-end complexity, other state managers get in the way more than should. So, to anyone who might be tempted to hate on React, but really has just grown weary of endless walls of action constants, or plumbing props, or fighting nested providers/contexts, or resorting to pub-sub; give something like Jotai a shot.
- 0xblinq 2y ago+1 I’ve used it in a largeish project and I liked it a lot. I rally hope I never have to deal again with redux or sagas
- babyshake 2y agoWhen I go to Jotai npm docs page (https://www.npmjs.com/package/jotai https://www.npmjs.com/package/jotai) I don't really get the impression of how this helps get away from using a lot of different context providers or Redux. The nice thing about context hooks is they are composable, combined with cached queries you can have a decently maintainable pattern. How does Jotai provide a tangible improvement on this?
- pixelsort 2y agoThe benefits would depends on how your code is structured, which dependencies you use, and overall complexity. Contexts provide and elegant developer experience, up until they don't. Have you ever implemented nested SplitView components under Dockview? It can be brutal on contexts. As a developer, I value solutions that never fail me. I wasn't driven to Jotai out of good taste. Simplicity and reliability are the benefits I find the most tangible. But Jotai's atomicity brings renderer optimizations as code splitting advantages that I haven't seen from the flux/redux clones before either.
- kn8 2y agohttps://github.com/KidkArolis/kinfolk https://github.com/KidkArolis/kinfolk - recoil/jotai, but simpler
- qudat 2y agoEveryone should try https://starfx.bower.sh https://starfx.bower.sh which is a fresh take on state and more importantly, side effect management.
- Rohansi 2y agoI don't understand why state management is filled with so much weird terminology. When I started working on a React app years ago every state management package I saw was filled with it - and they still are. I ended up rolling my own solution [1] to escape all that so I could focus on getting things done. It's been working great for me in production. Too bad there's no popular option that works similarly. [1] https://github.com/facepunch/react-class-model https://github.com/facepunch/react-class-model
- Izkata 2y agoLooking at how CounterDisplay and CounterControls work at the bottom of the README, the idea behind this is similar to Valtio (direct updates and changes are pushed on update), except with a lot more manual work. Valtio uses proxies and hooks to get the effect of CounterModel, CounterModelProvider, and useCounterModel automatically, without having to write them yourself. For comparison, Valtio has the same kind of "counter" example at the top of their README (first and third code blocks): https://github.com/pmndrs/valtio?tab=readme-ov-file#wrap-your-state-object https://github.com/pmndrs/valtio?tab=readme-ov-file#wrap-you...
- Rohansi 2y agoThat looks pretty similar but I like the use of classes in react-class-model to encourage keeping logic out of components. It's not shown in the readme but using context is optional - you can similarly achieve global state by storing it in a variable and then using `watchCounterModel` (the third return value from `defineModel`) to subscribe to updates on it. Both hooks also return proxies to re-render only when the referenced fields change.
- Izkata 2y agoThe people behind Jotai also made Zustand and Valtio: https://github.com/pmndrs/zustand https://github.com/pmndrs/zustand https://github.com/pmndrs/valtio https://github.com/pmndrs/valtio To me it feels like Jotai has too much manual boilerplate and Valtio has a lot of proxy "magic" that while I do like it I don't feel like it would be a good idea for a team. Zustand sits right in the middle of boilerplate-vs-magic, and is what I chose for a large project we're doing now.
- beaugunderson 2y agoI used Valtio for a guitar pedal librarian program recently and it's fantastic. Had zero issues with proxy state, it all "just worked".
- tuan 2y agomaybe the apps that I've worked on are not complex enough, but I found that Relay + Context API combo solves the state management problem for us. We have not had to use any state managers yet.