Building bigger apps

Reducers for complex updates, context for app-wide values, and the process of designing a React interface.

About 4 hours of study

Learning objectives

Lessons

  1. 1

    Reducers: organising state changes Advanced

    useReducer for state with many kinds of updates: actions that describe what happened, a pure reducer function that computes the next state, dispatching from event handlers, and when to prefer a reducer to useState.

  2. 2

    Context: sharing values across the tree Advanced

    Passing data deep into the tree without prop drilling: createContext, providing a value, useContext, combining context with state and reducers, and when context is and is not the right tool.

  3. 3

    Thinking in React Advanced

    How to build a React interface from a design: break it into a component hierarchy, build a static version from props, find the minimal state, decide where it lives, and add inverse data flow.

Module practice

Module quiz

1. What does dispatch do?
2. What problem does context solve?
3. Which may a reducer do?
4. What does useContext return with no provider above?
5. What should you build first for a new screen?
6. Which is minimal state for a searchable product list?

‹ Effects, refs and custom HooksFinal assessment ›