import { lock as active, unlock as inactive } from 'tua-body-scroll-lock' import { useUnmount } from 'react-use' export function useScrollLock(ref?: React.RefObject) { function lock() { active(ref?.current) } function unlock() { inactive(ref?.current) } useUnmount(() => { inactive(ref?.current) }) return { lock, unlock } }