2.0.0 • Published 2 years ago
@fatgy/use-navigation-lock v2.0.0
useNavigationLock
Navigation lock hook for next.js
Install
npm install @fatgy/use-navigation-lockUsage
import {useNavigationLock} from '@fatgy/use-navigation-lock';
useNavigationLock(true);
//=> Show confirm dialog
useNavigationLock(false);
//=> Not show confirm dialogAPI
useNavigationLock(isEnabled, warningText, onConfirm)
isEnabled
Type: boolean | undefined
Default: false
warningText
Type: string | undefined
Default: Are you sure you want to leave this page? You have unsaved changes. Do you want to leave?
onConfirm
Type: function | undefined