Mobx and Redux Toolkit have some relatively similar capabilities. It largely depends on whether you prefer FP-style code and explicit logic (Redux), or OOP-style code and implicit update behavior (Mobx).
Any particular aspects of Mobx you feel are easier to use, or parts of Redux you feel are harder? FWIW if you haven't looked at Redux recently, it's changed dramatically in the last couple years. "Modern Redux" with Redux Toolkit and the React-Redux hooks API is _much_ easier to use than the older-style "hand-written" patterns. With RTK, there's no `const ADD_TODO = "ADD_TODO"`, separate action creators, or object spreads for immutable updates. RTK's `createSlice` auto-generates action creators for you, and includes Immer for "mutating" immutable updates in reducers.
You can see the differences in our rewritten Redux docs tutorials:
Also note that last year we released a new RTK Query data fetching and caching API that's included in Redux Toolkit, which is a full-featured data caching abstraction. Define some API endpoints, get React query and mutation hooks automatically:
To be clear, Mobx is a great library, as are other packages like Zustand, Jotai, XState, and React Query. You should use whatever works best for your own use cases and preferences.
But, it's also true that most people's opinions of Redux are based on the older patterns that have been obsolete since 2019, and we get a ton of highly positive feedback about RTK on a daily basis, with people telling us how much they love to use it.
The fact that you still have the energy to reply to all these "isn't Redux bad/old/dead?" comments is a testament to the patience it must have taken to get this release out. Thanks for all your efforts.
Refactored a web app with traditional Redux logic to use Redux Toolkit and it really does make the logic much more pleasurable to read and maintain. I wasn't in love with the createAsyncThunk + builder.addCase pattern but it worked well enough in practice and isn't very hard to follow.
FWIW we'd _like_ to add the ability to define thunks inside of `createSlice`, but there's TS type circularity issues we've been unable to solve, so that's kept us from making it work right.
Also, I'd be curious to see if RTK Query can handle your data fetching use cases.
Sorry, I should have specified that it’s in work unrelated to RTK. I was just curious if the bugs we encounter are the same ones.
Unfortunately the circularity issues that are closely tracked in the TypeScript repo don’t seem to be making much progress, and in some cases, it seems like TS is fundamentally incapable of working with circular references in some contexts.
Like I was saying though, I find it hard to tell at times if I’m running into real limitations of the type system or I’m short a few IQ points, haha.
It was indeed the need to define the thunks outside of the slice that irked me, but with multiple thunks for a slice, I just wrote them as part of their own module.
Any particular aspects of Mobx you feel are easier to use, or parts of Redux you feel are harder? FWIW if you haven't looked at Redux recently, it's changed dramatically in the last couple years. "Modern Redux" with Redux Toolkit and the React-Redux hooks API is _much_ easier to use than the older-style "hand-written" patterns. With RTK, there's no `const ADD_TODO = "ADD_TODO"`, separate action creators, or object spreads for immutable updates. RTK's `createSlice` auto-generates action creators for you, and includes Immer for "mutating" immutable updates in reducers.
You can see the differences in our rewritten Redux docs tutorials:
- https://redux.js.org/tutorials/fundamentals/part-8-modern-re...
- https://redux.js.org/tutorials/essentials/part-2-app-structu...
Also note that last year we released a new RTK Query data fetching and caching API that's included in Redux Toolkit, which is a full-featured data caching abstraction. Define some API endpoints, get React query and mutation hooks automatically:
- https://redux.js.org/tutorials/essentials/part-7-rtk-query-b...
- https://redux-toolkit.js.org/rtk-query/overview
To be clear, Mobx is a great library, as are other packages like Zustand, Jotai, XState, and React Query. You should use whatever works best for your own use cases and preferences.
But, it's also true that most people's opinions of Redux are based on the older patterns that have been obsolete since 2019, and we get a ton of highly positive feedback about RTK on a daily basis, with people telling us how much they love to use it.