← Redux track

Example 3 — createAsyncThunk

Async API calls use createAsyncThunk and extraReducers for pending, fulfilled, and rejected. Same JSONPlaceholder API as the CSR demo.

Status: idle

No posts yet — click Fetch to run the async thunk.

Interview flow: dispatch thunk → pending sets loading → API returns → fulfilled/rejected updates store → every component using useSelector re-renders.

Files to read

Open these in the repo — each example is isolated in its own folder.

  • src/app/learn/redux/example-3-async-thunk/NOTES.md
  • src/app/learn/redux/example-3-async-thunk/_features/postsSlice.ts
  • src/app/learn/redux/example-3-async-thunk/_components/PostsDemo.tsx