React
React useEffect HookReact useEffect Hook
The useEffect Hook handles side effects like fetching data.
Read Time
5 min readDifficulty
BeginnerLast Updated
Jun 15, 2026Version
v1.0.0Introduction
React components should ideally just take data and render UI. The `useEffect` Hook handles everything else, known as "side effects." Developers use it to fetch API data, set up timers, or manipulate the DOM directly.
Example
Example
Key Points
- The first argument is a function that runs the effect.
- The second argument is a dependency array.
- An empty array `[]` makes the effect run only once.
- Missing dependencies can cause infinite rendering loops.