The useEffect Hook
React components must be pure. They should only calculate their output and do nothing else. However, sometimes you need to step outside the React lifecycle to perform actions like fetching data from a network API, manually changing the DOM layout, or setting up a socket subscription.
Custom Hooks
Custom Hooks allow you to extract complex state logic and side effects out of large components into dedicated, reusable functions.