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!
Top comments (0)