react.dev icon indicating copy to clipboard operation
react.dev copied to clipboard

useEffect example could use something different like scrollY or scrollX.

Open avsssai opened this issue 2 years ago • 0 comments

The useEffect example in the "Synchronizing with Effects" could use a different example, maybe like a window.scrollX or a window.scrollY instead of e.clientX and e.clientY as they don't exist on a scroll event and cause it to show undefined on scroll event.

useEffect(() => { function handleScroll(e) { console.log(e.clientX, e.clientY); } window.addEventListener('scroll', handleScroll); return () => window.removeEventListener('scroll', handleScroll); }, []);

image

avsssai avatar Mar 17 '23 08:03 avsssai