Browse Source

docs: changed useEffect example (#5711)

main
Siva Addanki 2 years ago
committed by GitHub
parent
commit
c2164d5131
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      beta/src/content/learn/synchronizing-with-effects.md

2
beta/src/content/learn/synchronizing-with-effects.md

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

Loading…
Cancel
Save