Lesson 25 of 3083%

(Progress persistence is disabled until Phase 9)

React
Beginner

Introduction to Hooks

What are hooks and what are their rules?

Hooks are special functions that let you “hook into” React features like state and lifecycle methods.

useState is the most common hook.

The Rules of Hooks

  1. Only Call Hooks at the Top Level: Do not call Hooks inside loops, conditions, or nested functions.
  2. Only Call Hooks from React Functions: Call them from within React components, or from custom Hooks.

Hooks always start with the word use (e.g., useEffect, useRef).

Try It Yourself

Lesson Progress

Take QuizBuild a React Project