UNPKG

@smitch/fluid

Version:

A lightweight, Tailwind-powered React/Next.js UI component library.

16 lines 553 B
import { useEffect } from 'react'; export var useDisableBack = function (usehook) { useEffect(function () { if (!usehook) return; window.history.pushState(null, document.title, window.location.href); function onBackButtonEvent(e) { e.preventDefault(); } window.addEventListener('popstate', onBackButtonEvent); return function () { window.removeEventListener('popstate', onBackButtonEvent); }; }, [usehook]); }; //# sourceMappingURL=useDisableBack.js.map