UI & Dom
useScrollLock
Whether the user processing page can scroll
- Import
- import { useScrollLock } from '@kubed/hooks;'
- Source
- View source code
- Docs
- Edit this page
- npm
- @kubed/hooks
Usage
useScrollLock Please click the button to see the effect
API
The useScrollLock hook accepts one parameter:
lock– whether to lock or not
1function useScrollLock(2lock?: boolean3): readonly [boolean, React.Dispatch<React.SetStateAction<boolean>>]
Params
| Parameters | Default Value | Type | Description |
|---|---|---|---|
| lock | false | boolean | Whether the page locks scrolling |
Result
| Parameters | Default Value | Type | Description |
|---|---|---|---|
| scrollLocked | - | boolean | Whether it is locked |
| setScrollLocked | - | React.Dispatch<React.SetStateAction<boolean>> | Set the current state |