Answers for "how to give top in reactjs in js"

0

toggle class onscroll hook react

const [scroll, setScroll] = useState(0)

  useEffect(() => {
    document.addEventListener("scroll", () => {
      const scrollCheck = window.scrollY < 100
      if (scrollCheck !== scroll) {
        setScroll(scrollCheck)
      }
    })
  })
Posted by: Guest on August-28-2020
-1

how to make page scroll to the top jsx

componentDidMount() {
  window.scrollTo(0, 0)
}
Posted by: Guest on November-01-2020

Code answers related to "how to give top in reactjs in js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language