5 ms·
Hi, I'm a Redux maintainer. Please note that "modern Redux" code is very different than what most older tutorials show. We've introduced newer APIs like Redux T
by acemarke 6y ago
Hi, I'm a Redux maintainer. Please note that "modern Redux" code is very different than what most older tutorials show. We've introduced newer APIs like Redux Toolkit, which is a set of utilities that provide a light abstraction to simplify the most common Redux tasks, and the React-Redux hooks API, which is generally easier to use than the traditional `connect` API.
I strongly recommend reading through the newly rewritten official tutorials in the Redux docs, which have been specifically designed to show our recommended practices:
- "Redux Essentials" tutorial [0]: teaches "how to use Redux, the right way", by building a real-world app using Redux Toolkit
- "Redux Fundamentals" tutorial [1]: teaches "how Redux works, from the bottom up", by showing how to write Redux code by hand and why standard usage patterns exist, and how Redux Toolkit simplifies those patterns
The older patterns shown in almost all other tutorials on the internet are still valid, but not how we recommend writing Redux code today.
You should also check out the Redux "Style Guide" docs page [2], which explains our recommended patterns and best practices, and why they exist. Following those will result in better and more maintainable Redux apps.
[0] https://redux.js.org/tutorials/essentials/part-1-overview-concepts https://redux.js.org/tutorials/essentials/part-1-overview-co...
[1] https://redux.js.org/tutorials/fundamentals/part-1-overview https://redux.js.org/tutorials/fundamentals/part-1-overview
[2] https://redux.js.org/style-guide/style-guide https://redux.js.org/style-guide/style-guide
- csande17 6y ago> Hi, I'm a Redux maintainer. We've heard your complaints that Redux adds a lot of unnecessary complexity and abstraction. Please note that we've now solved this problem in typical Redux fashion: by piling on additional layers of abstraction. > Also, I am going to continue posting this same comment on every discussion about Redux over and over for the rest of my life.
- littlecranky67 6y agoThis is so sad but true. Redux-Toolkit now abstracts away the abstractions introduced by Redux & Co. in the first place. Think about that.
- acemarke 6y agoNot sure I agree with this statement. The Redux core by itself doesn't really introduce abstractions. A reducer is just a function. An action is just an object. They're not abstractions, just a particular usage pattern.
- littlecranky67 6y agoI do not agree with your argument; a reducer itself is an abstraction of state management, that implies quite a lot (pure function, immutable operations etc.) React itself (especially when considering the stable context API and hooks) does not introduce those concepts of reducers or immutable operations at all (except for the fully optional useReducer hook that was added, but not present in previous React versions). So its - at least to some extend - additional abstraction not present otherwise.
- wilsonrocks 6y agoI've tried redux toolkit in production and it is a lot better... But I still wouldn't choose redux on balance.