useScrollLock
Lock background scrolling without layout shifting.
useScrollLock.tsx
import { useScrollLock } from "@cermuel/hooks/react";export function useScrollLockExample() { const { locked, lock, unlock } = useScrollLock(); return <button type="button" onClick={locked ? unlock : lock}>{locked ? "Unlock" : "Lock"}</button>;}Props
Param
Type
Default Value
initial?booleanfalseReturns
{ locked: boolean; lock: () => void; unlock: () => void; toggle: () => void; }