React setState after scrolling Xpx

PHOTO EMBED

Sun May 08 2022 14:13:38 GMT+0000 (UTC)

Saved by @McDev #react.js

const [scroll, setScroll] = useState(false)

  useEffect(() => {
    window.addEventListener("scroll", () => {
      setScroll(window.scrollY > 200)
    })
    return function cleanup() {
      setScroll(true)
    }
  }, [])
content_copyCOPY

https://github.com/MartinConde/asuree/blob/main/src/components/layout.js