Skip to main content

Custom Hooks and Patterns

3 lessonsAbout 18 minutesAdvanced

This part of the React Tutorial runs from Writing Custom Hooks through to Where to Go Next. There are 3 lessons here, and working through them takes about 18 minutes at a steady pace.

It follows on from Performance, so finish that first if you have not already — the examples below assume you are comfortable with it.

Each lesson below says what it covers before you open it. Read them in order the first time; afterwards this page works as a index you can jump back into when you need to check one thing.

  1. 1Writing Custom HooksA custom hook is a function that calls other hooks. Learn how to extract stateful logic, why each caller gets its own state, and how to name one.
  2. 2Component PatternsPresentational and container components, composition over configuration, and the prop-count signals that a component is doing too much.
  3. 3Where to Go NextWhat to learn after React fundamentals: routing, data fetching, forms, testing and frameworks — with an honest view of what you actually need.