1useEffect(() => {
2 //will be called on every load
3})
4
5useEffect(() => {
6 //will be called on component mount
7 window.addEventListener('mousemove', () => {});
8
9 // returned function will be called on component unmount
10 return () => {
11 window.removeEventListener('mousemove', () => {})
12 }
13}, []) // <---- empty array at end will cause to only run on first load