Frontend & browser·State, data and re-rendering
you needed to reach outside the component — to the DOM, a socket, a timer — after the render finished.
Effect
Also calledside effect, useEffect
Code that runs after render to synchronise the component with something outside the framework's control. It exists for subscriptions, imperative DOM work and non-React widgets, and it is routinely misused for deriving values or fetching data, both of which have better answers. Every effect that sets up something needs a cleanup, because it will run again on the next dependency change and twice in development on purpose.