useScrollLock
A custom hook that locks and unlocks scroll.
A custom hook that locks and unlocks scroll.
Usage
import { useScrollLock } from "@tilt-legal/cubitt-components/utilities/hooks";
// Lock the scroll when the modal is mounted, and unlock it when it's unmounted
useScrollLock()API
Signature
declare function useScrollLock(options?: UseScrollLockOptions): UseScrollLockReturn;Parameters
| Parameter | Type | Description | Default |
|---|---|---|---|
[options] | UseScrollLockOptions | Options to configure the hook, by default it will lock the scroll automatically. | - |
Return Value
| Value | Type | Description |
|---|---|---|
return | UseScrollLockReturn | - An object containing the lock and unlock functions. |