The Effect Hook
Need for the Effect Hook
With class components, you’ve likely performed side effects such as logging, fetching data, or managing subscriptions.
These side effects may be called “effects” for short, and the effect hook,
useEffect was created for this purpose.
How is it used?
useEffect hook is called by passing it a function within which you can perform your side effects.
Below is a quick example: