@breadhead/with-scroll-lock

passes props for locking and unlocking body scroll to React component

Usage no npm install needed!

<script type="module">
  import breadheadWithScrollLock from 'https://cdn.skypack.dev/@breadhead/with-scroll-lock';
</script>

README

with-scroll-lock

Instalation

yarn add @breadhead/with-scroll-lock

Usage

import * as React from "react";
import withScrollLock from "@breadhead/with-scroll-lock";


const Test = ({ bodyScrolling: { lock, unlock }}) => 
<div>
  <button onClick={lock}>lock scroll</button>
  <button onClick={unlock}>unlock scroll</button>
</div>  

export default withScrollLock(true)(Test)