The Effect Hook

What is the useEffect hook and how is it used to save states effect.

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?

Well, the useEffect hook is called by passing it a function within which you can perform your side effects.

Below is a quick example:

Get hands-on with 1200+ tech skills courses.