DEV Community

Mubasshir Ahmed
Mubasshir Ahmed

Posted on

3 3

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)

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