DEV Community

Jayant Khandelwal
Jayant Khandelwal

Posted on • Edited on

useEffect (How Cool is It?)

Alt Text

Learning useEffect vs Enjoying Coffee?

(I would prefer useEffect! What about you?)

useEffect Hook lets us to perform side effects in react functional components.

It is a replacement of componentDidMount , componentDidUpdate and componentWillUnmount (these are used along-side class-based components to perform side effects).

Mutations, subscriptions, timers, logging, and other side effects are not allowed inside the main body of a function component. We use useEffect hook to overcome these problems. The function passed to useEffect will run after the render is committed to the screen.

Stay connected for the series of blogs on React hooks with detailed examples!

What do you think which one is better - useEffect or componentDidUpdate/Mount??

Type it down in the comments section below

Happy Coding!!

Cheers!
-Jayant Khandelwal

P.S: If you share it, it will make my day!

Buy Me A Coffee

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay