How to Fetch Data with Redux Toolkit Thunks (createAsyncThunk) | React Tutorial #6

Опубликовано: 08 Июнь 2026
на канале: Rowadz
74,568
1k

Learn how to fetch data from an API using createAsyncThunk in Redux Toolkit!
In this episode, we walk through building a simple data flow using thunks — from setting up your slice to handling API states like pending, fulfilled, and rejected. Great for beginners and anyone looking to level up with Redux Toolkit!

☕ Like the video? Buy me a coffee:
https://www.buymeacoffee.com/rowadz

🧠 Full repo (React + Redux Toolkit example):
https://github.com/Rowadz/react-redux...

🔧 Try generating your own API for practice:
https://pollux.dev/

📺 Watch next:
Redux Toolkit Series ▶    • 🏟️ Redux Toolkit 🏟️  
createAsyncThunk Deep Dive ▶    • in-depth createAsyncThunk - redux toolkit  

📚 Resources Mentioned:

JSON Placeholder API: https://jsonplaceholder.typicode.com/

createAsyncThunk Docs: https://redux-toolkit.js.org/api/crea...

createSlice Docs: https://redux-toolkit.js.org/api/crea...

useDispatch Hook: https://react-redux.js.org/api/hooks#...

useSelector Hook: https://react-redux.js.org/api/hooks#...

Redux Toolkit Docs: https://redux-toolkit.js.org/

ImmerJS: https://immerjs.github.io/immer/docs/...

JavaScript Proxy API: https://developer.mozilla.org/en-US/d...

⏱️ Timestamps:
00:00 Introduction
00:17 Showing you the current app we have
00:38 The API we will use
01:10 Creating a Posts slice and a component
01:57 The thunk reducers (extraReduces)
02:20 Creating a thunk using createAsyncThunk
03:35 The dispatched actions from the thinks
03:35 Handling the pending action
04:28 Handling the fulfilled action
05:05 Handling the rejected action
05:28 export our slice, a recap of what we did, and add our reducer to the store
06:50 How we can dispatch our thinks
09:45 Why we should use useEffect here to dispatch our thunk
11:14 Seeing the thunk actions in the redux dev tool
11:55 Passing data to thunks
12:30 How to dispatch other actions in a thunk
13:23 How to access the store state in any thunk
14:04 Logging part of the state and using the passed data to the thunk
15:42 Done