Home/Tutorials/React/useEffect

0 of 2 saved

React5 min read

useEffect

Read this chapter, then pass a short check to open the next one.

Synchronize with the outside world.

useEffect

useEffect runs after paint. Use it for fetching, subscriptions, and timers. Return a cleanup function when you subscribe.

  • Dependency array controls when the effect re-runs.
  • [] means run once on mount.
  • Do not ignore exhaustive-deps warnings blindly.

After you read this chapter, use Write (when available) and Quiz on this page to lock it in.