Last modified: 4/Oct/2024
useScrollLock
This hook is used to lock the scroll on the body element.
#Usage
import { useScrollLock, Modal } from '@kinsta/stratus' const MyComponent = () => { const { setScrollEnabled } = useScrollLock() useEffect(() => { if (!disableScroll) { return } setScrollEnabled(false) return () => setScrollEnabled(true) }, [setScrollEnabled]) return <Modal isVisible>{children}</Modal> }
#Parameters
#removeScrollbar
boolean
#maintainFixedFullWidthElements
boolean