docs: changed useEffect example (#5711)

This commit is contained in:
Siva Addanki
2023-03-18 04:56:26 +05:30
committed by GitHub
parent c1f6dc9b11
commit c2164d5131

View File

@@ -630,7 +630,7 @@ If your Effect subscribes to something, the cleanup function should unsubscribe:
```js {6}
useEffect(() => {
function handleScroll(e) {
console.log(e.clientX, e.clientY);
console.log(window.scrollX, window.scrollY);
}
window.addEventListener('scroll', handleScroll);
return () => window.removeEventListener('scroll', handleScroll);