Back to search

useEffect basics and how it differs from lifecycle methods

useEffect runs side effects after rendering and replaces many class lifecycle use cases in function components.

React Easy Theory

useEffect basics and how it differs from lifecycle methods

useEffect runs side effects after rendering and replaces many class lifecycle use cases in function components.

  • Effects run after render
  • Dependency arrays control when they re-run
  • Effects should synchronize with the outside world

useEffect basics and how it differs from lifecycle methods