Skip to content

Instantly share code, notes, and snippets.

View YazzerJM's full-sized avatar

Yasser Jiménez Martínez YazzerJM

  • ASF - Auditoría Superior de la Federación
  • CDMX, México.
  • 08:19 (UTC -06:00)
  • LinkedIn in/yazzerjm
View GitHub Profile
@YazzerJM
YazzerJM / useScrollBlock.js
Created June 7, 2023 22:41 — forked from reecelucas/useScrollBlock.js
React hook to enable/disable page scroll
import { useRef } from 'react';
const safeDocument = typeof document !== 'undefined' ? document : {};
/**
* Usage:
* const [blockScroll, allowScroll] = useScrollBlock();
*/
export default () => {
const scrollBlocked = useRef();