react-hooks-bank
Version:
A collection of **powerful, reusable custom React hooks** for complex, non-trivial interactions that go beyond React’s native features.
11 lines (10 loc) • 345 B
JavaScript
import { useEffect } from "react";
export function useLockBodyScroll() {
useEffect(function () {
var originalOverflow = window.getComputedStyle(document.body).overflow;
document.body.style.overflow = "hidden";
return function () {
document.body.style.overflow = originalOverflow;
};
}, []);
}