Freezes the page's scroll under Modal and ConfirmModal.

Functions

f
useScrollLock(): void

Freezes the page's scroll while the calling component is mounted, so that the page doesn't slide under a dialog's backdrop. Nested locks are counted.

Usage

import * as mod from "src/hooks/shared/useScrollLock.ts";