react.dev
react.dev copied to clipboard
useEffect example could use something different like scrollY or scrollX.
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); }, []);
