mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-22 03:42:14 +00:00
docs: changed useEffect example (#5711)
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user