useEffect() allows us to fetch requests, manipulate DOM, using timer function etc.
useEffect(() => {
.......// logic
},[dependencies])
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)