DEV Community

Discussion on: What is useEffect Hook in ReactJS?How useEffect works and where to use it?

Collapse
 
mikenatsu profile image
MikeNatsu • Edited

for a cleanup function you would use return inside of it, might look like this

useEffect(()=>{
// Code
return () => {
//code
}

},[]);

here's an example from react docs

reactjs.org/docs/hooks-effect.html...