React·100 questions

How does useEffect work and what is it used for?

Answer
useEffect performs side effects after rendering.
Suitable for subscriptions, requests, DOM manipulation.
Dependencies are set with an array deps.
Returning a function — cleanup.
Do not use useEffect for computing derived state.
Was this answer helpful?

More questions in this topic

Related questions from other topics