Which React hook is used for executing side effects in functional components?

  • useContext
  • useEffect
  • useReducer
  • useState
The useEffect hook in React is used for executing side effects in functional components. Side effects include tasks like data fetching, DOM manipulation, and subscriptions. useEffect allows you to perform these tasks after rendering and to handle cleanup when the component unmounts, ensuring that side effects do not disrupt the component's behavior.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *