React
React useContext HookReact useContext Hook
The useContext Hook reads global data without passing props.
Read Time
5 min readDifficulty
BeginnerLast Updated
Jun 15, 2026Version
v1.0.0Introduction
Passing props down through ten levels of components is annoying, known as "prop drilling." The `useContext` Hook creates a global data portal. Any component, no matter how deep, can tap into this portal to read the data instantly.
Example
Example
Key Points
- It solves the problem of "prop drilling."
- The `createContext()` function builds the portal.
- The `Provider` wraps the parent component to supply the data.
- The `useContext` Hook reads the data inside the child component.