In react for useEffect the clean up is done by return () => { // clean up }