@c15t/react
Version:
Developer-first CMP for React: cookie banner, consent manager, preferences centre. GDPR ready with minimal setup and rich customization
2 lines • 450 B
JavaScript
'use client';
import*as e from"react";function o(o){(0,e.useEffect)(()=>{if(o){let e={overflow:document.body.style.overflow,paddingRight:document.body.style.paddingRight},o=window.innerWidth-document.documentElement.clientWidth;return document.body.style.overflow="hidden",o>0&&(document.body.style.paddingRight=`${o}px`),()=>{document.body.style.overflow=e.overflow,document.body.style.paddingRight=e.paddingRight}}},[o])}export{o as useScrollLock};