Custom Hooks
Extract stateful logic into functions you can reuse, learn the rules that make a function a hook, and build the handful of hooks every project ends up needing.
- Level
- Intermediate
- Chapters
- 4
- Exercises
- 1
- Reading time
- 15 min
What you will cover
- 1. What Makes a Custom HookThe naming rule, what gets shared and what does not.
- 2. Extracting a HookRefactoring a component into a hook, and choosing what to return.
- 3. Hooks Worth WritingFour small hooks that show up in almost every project.
- 4. Lesser-Known Built-in HooksThree hooks that solve specific problems custom hooks often need.
Up next after this one: Component Patterns