Skip to content
Tutorials Center
My learning

Topics

Redux Tutorial

Learn Redux step by step: 41 lessons in 9 chapters with examples, quizzes, diagrams and projects.

Start learning →

of lessons completed

Getting Started

  1. 1 What Is Redux? Learn what Redux is, the problem it solves and its three building blocks: store, actions and reducers. Includes live examples and a clear note on what runs in our editor.
  2. 2 When to Use Redux Decide whether Redux fits your app. Compare it with useState, Context and server-state libraries, learn the signs of too much shared state and use a simple scoring checklist.
  3. 3 Setting Up a Redux Project Install Redux Toolkit and React-Redux, create a store, add a slice and connect it to a React app with Vite. Includes a recommended folder layout and a runnable wiring demo.
  4. 4 Your First Redux App Build two small Redux apps step by step: a counter and a todo list. See state, actions, reducers, selectors and dispatch work together in live React examples.
  5. 5 Redux DevTools and Time Travel Use the Redux DevTools extension to inspect every action, see state diffs, skip actions and jump through history. Learn why pure reducers make time travel possible, with live demos.

Core Concepts

  1. 6 State and Immutability in Redux Learn what belongs in Redux state, why you must never mutate it and how to copy objects, nested data and arrays safely with spread, map and filter. Live examples included.
  2. 7 Actions and Action Creators in Redux Learn what a Redux action is, how to name types, structure payloads, write action creators and think of actions as events instead of setters. Live examples included.
  3. 8 Reducers in Depth Master Redux reducers: the three rules, initial state, switch and lookup styles, splitting a big reducer into smaller ones, handling unknown actions and testing reducers as plain functions.
  4. 9 The Redux Store Understand the Redux store API: getState, dispatch, subscribe, preloaded state and replaceReducer. Learn the subscription rules, why createStore is deprecated and how configureStore replaces it.
  5. 10 Combining Reducers and State Shape Learn how combineReducers builds a root reducer, how each slice sees only its own state, how to design a normalized state shape and how to reset the whole store on logout.

Redux Toolkit

  1. 11 Why Redux Toolkit? See why Redux Toolkit is the official way to write Redux. Compare hand-written Redux with createSlice, tour what RTK includes and learn what runs in our editor and what needs the real package.
  2. 12 configureStore in Redux Toolkit Learn configureStore options: reducer, middleware with getDefaultMiddleware, devTools, preloadedState and enhancers. See the default middleware and dev checks work in live stand-ins.
  3. 13 createSlice in Redux Toolkit Learn createSlice: name, initialState, reducers, generated actions, extraReducers for other slices' actions, prepare callbacks and slice selectors. Includes runnable stand-ins and the real API.
  4. 14 Immer in Redux Toolkit Reducers Understand how Immer lets Redux Toolkit reducers look like mutation yet stay immutable. Learn the mutate-or-return rule, current and original, auto-freezing and the common Immer pitfalls.
  5. 15 createAction and createReducer Learn Redux Toolkit's createAction (with prepare callbacks and match) and createReducer (builder addCase, addMatcher, addDefaultCase), the building blocks beneath createSlice, with runnable stand-ins.

Redux with React

  1. 16 Provider and the React-Redux Hooks Connect Redux to React with react-redux: wrap your app in Provider, read state with useSelector and dispatch actions with useDispatch. Build a shared cart in a live example.
  2. 17 useSelector in Depth Master react-redux useSelector: how it compares results, why selectors that return new arrays cause extra renders, and how shallowEqual and memoized createSelector selectors fix it. Runnable demos.
  3. 18 useDispatch and Events Learn to dispatch Redux actions from event handlers, forms, effects and child components with useDispatch. Cover payload design, batching, dispatch in effects and common mistakes, with live demos.
  4. 19 Organizing Redux Code Structure a Redux Toolkit app with feature folders, slice files, selectors, typed hooks and app-level setup. Learn the style guide rules that matter and avoid circular imports. Runnable examples included.
  5. 20 Connect and Legacy Redux Read and migrate older Redux code: connect with mapStateToProps and mapDispatchToProps, class components, hand-written reducers and action constants, and how each maps to hooks and Redux Toolkit.

Async Logic and Data Fetching

  1. 21 Async Logic and Thunks Learn why reducers must stay pure, how thunk middleware lets you dispatch functions, and how to model loading, success and error states for async work in Redux.
  2. 22 createAsyncThunk Understand createAsyncThunk in Redux Toolkit: the pending, fulfilled and rejected actions, extraReducers, rejectWithValue, conditions, cancellation and unwrap.
  3. 23 RTK Query Basics Learn RTK Query: createApi, endpoints, auto-generated hooks, cache keys, reference counting and refetching, with a runnable cache stand-in that shows the core idea.
  4. 24 RTK Query Mutations and Tags Learn how RTK Query mutations change server data, how providesTags and invalidatesTags refetch stale queries, and how optimistic updates with rollback work.

Middleware and Selectors

  1. 25 How Redux Middleware Works Understand the Redux middleware signature store => next => action, how applyMiddleware composes a pipeline, and where middleware sits between dispatch and the reducer.
  2. 26 Writing Custom Middleware and Listeners Write practical Redux middleware: logging, crash reporting, analytics, debouncing and API calls, and learn when RTK's listener middleware is the cleaner choice.
  3. 27 Selectors and Memoization (Reselect) Learn Redux selectors, why derived data should not be stored, how createSelector memoizes results, parameterized selectors and common reselect pitfalls, with runnable examples.
  4. 28 createEntityAdapter Learn how createEntityAdapter stores collections as ids plus entities, generates CRUD reducers and selectors, supports sorting, and how to build the same idea by hand.

Patterns and Performance

  1. 29 Designing and Normalizing State Shape Learn how to design Redux state: what belongs in the store, how to normalize nested API data into lookup tables, avoid duplication, and keep derived data out of state.
  2. 30 Immutable Updates and Immer Why Redux state must never be mutated, how to write correct immutable updates by hand, how Immer drafts make mutating syntax safe in createSlice, and the pitfalls to avoid.
  3. 31 Re-renders and Performance in Redux Learn how React-Redux decides when to re-render, how useSelector equality works, how to avoid unnecessary renders with narrow selectors, and how to keep Redux apps fast.
  4. 32 Undo/Redo and Persisting State Build undo and redo with a higher-order reducer, then persist and rehydrate Redux state safely with versioning and migrations. Runnable examples included.

Testing and Tooling

  1. 33 Testing Reducers, Selectors and Thunks Learn how to test Redux logic: pure reducers and selectors with simple assertions, thunks with fake dispatch and APIs, and whole-store integration tests. Runnable examples.
  2. 34 Testing React Components with Redux Test connected React components with a real Redux store: a renderWithProviders helper, preloaded state, user events, and mocking the network with MSW for RTK Query apps.
  3. 35 Redux DevTools and Debugging Use the Redux DevTools extension for the action log, state diffs and time travel, configure it in Redux Toolkit, sanitize sensitive data, and debug common Redux problems step by step.
  4. 36 TypeScript with Redux Toolkit Type a Redux Toolkit app: infer RootState and AppDispatch from the store, create typed hooks with withTypes, type slices, PayloadAction, createAsyncThunk and RTK Query endpoints.
  5. 37 Migrating Legacy Redux to Redux Toolkit Modernize an older Redux codebase step by step: switch to configureStore, replace switch reducers with createSlice, remove action constants, use hooks and RTK Query, one feature at a time.

Projects and Practice

  1. 38 Project: A Todo List with Redux Build the classic Redux project in steps: design the state, write the slice, add filters and selectors, test it, then see the Redux Toolkit and React version side by side.
  2. 39 Project: A Shopping Cart with Redux Build a shopping cart in Redux: a product catalog slice, cart quantities, money in cents, coupon codes, memoized totals and a checkout thunk that updates several slices at once.
  3. 40 Project: An Async Data Dashboard Build the data layer of a dashboard in Redux: per-widget loading states, request ids to ignore stale responses, a freshness cache, retries with backoff, and polling, all runnable.
  4. 41 Redux Practice Exercises Practice Redux with hands-on exercises: write a reducer, a memoized selector, a logging middleware and a thunk. Each runnable starter has checks, followed by full solutions.