Skip to content

Topics

Jump to a topic.

Search questions

Find a question by title, tag, or summary.

Chapter 03

Effects

Effects synchronize a component with something outside React. This chapter covers when they run, how dependencies decide re-runs, cleanup, the layout variants, when an effect is the wrong tool, and Effect Events.
  1. 010When does useEffect run, and what is it for?Coremedium
  2. 020How do effect dependencies work, and how do you fix a stale closure?Corehard
  3. 030Why does an effect run twice in development, and how should cleanup work?Coremedium
  4. 040When do you need useLayoutEffect instead of useEffect?medium
  5. 050Which effects shouldn't be effects?Coremedium
  6. 060What problem does useEffectEvent solve?hard