useReducer is a convenient React Hook that lets you manage complex state updates, as much as you would do with a Redux reducer. useReducer, and the Context API might look like a replacement for Redux, but don’t get fooled.

I enjoy using React hooks, but I also like Redux so much, and these days with Redux Toolkit Redux is even more compelling.

While working with useReducer I found myself thinking: now that we have createAction, createReducer, createSlice in Redux Toolkit, why on earth would I write a reducer with its actions by hand even if I’m using just useReducer?

#react #redux

React's useReducer with Redux Toolkit. Why not?
10.40 GEEK