1.0.3 • Published 5 years ago

react-use-scroll-lock v1.0.3

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

react-use-scroll-lock Build Status

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;