replace old docs
This commit is contained in:
@@ -2,7 +2,9 @@ import { useState } from "react"
|
||||
import { useWindowEvent } from "./use-window-event"
|
||||
|
||||
export function useScrolled() {
|
||||
const [scrolled, setScrolled] = useState(false)
|
||||
const [scrolled, setScrolled] = useState(
|
||||
typeof window !== "undefined" ? window.scrollY > 0 : false,
|
||||
)
|
||||
useWindowEvent("scroll", () => setScrolled(window.scrollY > 0))
|
||||
return scrolled
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user