import { FC, useEffect, useRef } from 'react' import s from './Sidebar.module.css' import cn from 'classnames' import { disableBodyScroll, enableBodyScroll, clearAllBodyScrollLocks, } from 'body-scroll-lock' interface SidebarProps { children: any onClose: () => void } const Sidebar: FC = ({ children, onClose }) => { const ref = useRef() as React.MutableRefObject useEffect(() => { console.log('Sidebar', ref) if (ref.current) { disableBodyScroll(ref.current) } return () => { clearAllBodyScrollLocks() } }, []) return (
{children}
) } export default Sidebar