News for hackers. Stuff that matters.
Re:Recoil – A state management library for React by vosper on Thursday May 14, 2020 @02:23PM (#23183326)
> I still haven't found anything that beats Redux on its own without thunks or sagas

There was a period in the early days of Redux where MobX [0] (and, perhaps to a lesser extend, MobX State Tree [1]) was the main competitor to Redux that I used to hear about. They both seem to be actively developed, but I don't hear so much about them any more. Have you ever look at either of them?

BTW I am 100% with you on Sagas.

[0] MobX https://mobx.js.org/README.html#introduction [1] MobX State Tree: https://mobx-state-tree.js.org/intro/philosophy

Re:Recoil – A state management library for React by tekkk on Thursday May 14, 2020 @03:04PM (#23183914)
At least in the company where I worked in, everyone agreed that Mobx was the better option between it and Redux. It's so much more intuitive to grasp and using simple functions and objects much easier, than having to grok weird async-flows and cumbersome action-generators and whatnot.

Only problem so far, or inconvenience maybe, is the sometimes complicated ways you come to intertwine stores which have access to different parts of the fetched API data. So if you need data Y stored in store X inside store Z, you have to inject store X as dependency to store Z. Getting too carried way with these injections can make your whole state quite messy. Or loading too much logic into one store.

Probably that's just an architectural issue, that can be remedied with enough thought put into it, but I haven't at least found a clear pattern that would make it simple to decide when to break up stores, or how to refactor them.

Also you have be aware of the complexities of observables which are a bit magical. Knowing when observables don't update and how to observe in general is very much a necessity (unless you want interesting bugs).

I have been curious to try out Mobx State Tree but alas haven't had time.

Re:Recoil – A state management library for React by armandososa on Thursday May 14, 2020 @02:40PM (#23183569)
MobX State Tree advocate here. We have a VERY complex state that needs to be synced with the server and persisted locally and nothing fulfilled our needs like MST.

Also, sign me up to the Sagas-are-bullshit club.

Re:Recoil – A state management library for React by topspin on Thursday May 14, 2020 @02:55PM (#23183776)
Mobx itself is insufficient? What does mobx-state-tree provide that mobx does not? The README doesn't convey anything meaningful.
Re:Recoil – A state management library for React by armandososa on Monday May 18, 2020 @06:55PM (#23229342)
Well, you know how MobX itself is very unopinionated? MST is very structured and opinionated. It's also immutable which means you get snapshots of every mutation to the tree which is very useful in almost all cases.
Re:Recoil – A state management library for React by Keats on Thursday May 14, 2020 @03:18PM (#23184084)
Mobx itself is fine for most usecases I think. I've used it on 4-5 projects now and it's been working very well in each.
Re:Recoil – A state management library for React by artminister on Thursday May 14, 2020 @11:48PM (#23188703)
Zustand works for us without much complexity. Its fast and quite easy to use

https://github.com/react-spring/zustand/

Re:Recoil – A state management library for React by hashkb on Thursday May 14, 2020 @02:47PM (#23183675)
I still use mobx for almost everything. Sometimes without React (like a dmx light controller and a midi controller for guitar effects).