split stuff up
This commit is contained in:
8
packages/docs/app/hooks/dom/use-scrolled.ts
Normal file
8
packages/docs/app/hooks/dom/use-scrolled.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { useState } from "react"
|
||||
import { useWindowEvent } from "~/hooks/dom/use-window-event"
|
||||
|
||||
export function useScrolled() {
|
||||
const [scrolled, setScrolled] = useState(false)
|
||||
useWindowEvent("scroll", () => setScrolled(window.scrollY > 0))
|
||||
return scrolled
|
||||
}
|
||||
Reference in New Issue
Block a user