In this video, we use createEntityAdapter from Redux Toolkit to set up a normalized state structure, and connect it to an async thunk for fetching data.
We also explore the generated action creators and how to wire everything into the Redux store with React.
☕ Found it useful? Buy me a coffee:
https://www.buymeacoffee.com/rowadz
📂 Code Repo:
https://github.com/Rowadz/react-redux...
📺 Related Videos:
🔁 Previous (Normalize State Intro): • Normalizing Redux State with createEntityA...
🧠 Follow-Up (Multiple Adapters in One Slice): • Combine Multiple createEntityAdapter State...
📚 Entity Adapter Series: • Entity Adapter CRUD - redux toolkit
⚛️ Redux Toolkit Series: • 🏟️ Redux Toolkit 🏟️
⚛️ React + Redux: • ⚛️ Redux & React ⚛️
📄 Docs Mentioned:
createEntityAdapter: https://redux-toolkit.js.org/api/crea...
⏱️ Timestamps:
00:00 - Intro
00:55 - What createEntityAdapter actually does
03:09 - Exploring the official docs
04:00 - Auto-generated action creators
05:16 - Writing a thunk to fetch data
07:36 - Creating the users slice
08:12 - Using adapter methods in reducers
10:33 - setAll() in action
11:07 - Hooking the slice into the store
11:30 - Dispatching in the component
13:10 - Redux DevTools view
14:18 - Handling nested object normalization