DEV Community

Mubasshir Ahmed
Mubasshir Ahmed

Posted on

useEffect() ReactJS long story short

useEffect() allows us to fetch requests, manipulate DOM, using timer function etc.

useEffect(() => {
   .......// logic
},[dependencies])

Enter fullscreen mode Exit fullscreen mode

useEffect() hook accepts two arguments .
1) callback function
2) dependencies
callback contains side-effect logic.
put all your side effect logic into the callback function, then use the dependencies when you want to side effect to run.

reference: https://dmitripavlutin.com/react-useeffect-explanation/

Top comments (0)