- Redux Toolkit (RTK) is the standard way to write Redux logic
- RTK includes APIs that simplify most Redux code
- RTK wraps around the Redux core, and includes other useful packages
configureStore
sets up a Redux store with good defaults- Automatically combines slice reducers to create the root reducer
- Automatically sets up the Redux DevTools Extension and debugging middleware
createSlice
simplifies writing Redux actions and reducers- Automatically generates action creators based on slice/reducer names
- Reducers can “mutate” state inside
createSlice
using Immer
createAsyncThunk
generates thunks for async calls- Automatically generates a thunk +
pending/fulfilled/rejected
action creators - Dispatching the thunk runs your payload creator and dispatches the actions
- Thunk actions can be handled in
createSlice.extraReducers
- Automatically generates a thunk +
createEntityAdapter
provides reducers + selectors for normalized state- Includes reducer functions for common tasks like adding/updating/removing items
- Generates memoized selectors for
selectAll
andselectById
References
https://redux.js.org/tutorials/fundamentals/part-8-modern-redux