i was going through a react course for John Smilga on freecodecamp youtube channel and he was explaining the uses of useEffect hooks. I tried to do the same example without the useEffect function and it worked exactly the same. As you can see in the following image, his original code is commented out and i just copied out “window.addEventListner(‘resize’', checkSize)” , which worked just fine.
so is there a difference here that am not comprehending?