4 ms·
Do you have a quick link on what's changed recently? I haven't used the framework in a couple of years.
by chrisco255 6y ago
Do you have a quick link on what's changed recently? I haven't used the framework in a couple of years.
- city41 6y agoThe biggest improvement IMO is the toolkit, which gives you an off the shelf packaged Redux implementation. The toolkit has support for slices and Immer out of the box. https://redux-toolkit.js.org/ https://redux-toolkit.js.org/
- acemarke 6y agoAs mentioned in a sibling comment: We have a new official "Redux Toolkit" package [0], which is now our recommended way to write Redux logic. It includes utilities to simplify several common Redux use cases, including store setup, defining reducers, immutable update logic, and even creating entire "slices" of state at once. We've also recently added APIs for basic async data fetching via thunks, and reusable functions for managing normalized entity state. Meanwhile, we now recommend the React-Redux hooks API [1] as the default way to interact with the Redux store in your components. It provides `useSelector` and `useDispatch` hooks, which are lighter-weight and generally easier to understand and work with than `connect` is. They're also much easier to use with TypeScript. The Redux docs have always been very unopinionated, and just said "here's 3 different ways to do this task" (such as describing the typical "folder-by-type" / "feature folder" / "ducks" folder structures, but not giving an actual suggestion on which approach to use). We now have a "Style Guide" docs page [2] that gives our actual recommendations on how to use Redux the right way, such as "put more logic in Reducers", "model actions as 'events' instead of 'setters' ", and "use the 'ducks' pattern for single-file logic". So, while the actual Redux core hasn't changed, the way you'd write your Redux code now would be significantly different than what you might have seen a couple years ago, and the new "Redux Essentials" tutorial linked in this HN thread is intended to teach these latest practices. [0] https://redux-toolkit.js.org https://redux-toolkit.js.org [1] https://react-redux.js.org/api/hooks https://react-redux.js.org/api/hooks [2] https://redux.js.org/style-guide/style-guide https://redux.js.org/style-guide/style-guide
- platz 6y agoImmer also is a huge improvement in combination with Redux