24.
What is the purpose of the useEffect() hook in React?
It is used to fetch data from an API.
It is used to handle form submissions.
It is used to update the state of a component.
It is used to perform side effects in functional components.
Correct: D
The useEffect() hook is used to perform side effects in functional components. Side effects include fetching data, subscribing to events, or manually changing the DOM. It is similar to componentDidMount, componentDidUpdate, and componentWillUnmount combined in class components.