react-use-scroll-lock
v1.0.3
Published
react hook to conditionally lock body scroll
Downloads
11
Maintainers
Readme
react-use-scroll-lock
React custom hook to conditionally enable body scroll lock.
Installation
npm install --save react-use-scroll-lock
Usage
import React, { useState } from 'react';
import useScrollLock from 'react-use-scroll-lock';
const MyComponent = () => {
const [shouldLockBody, setShouldLockBody] = useState(false);
useScrollLock(shouldLockBody);
return <div> Hi World </div>;
}
export default MyComponent;