2.0.0 • Published 5 months ago

@fatgy/use-navigation-lock v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

useNavigationLock

Navigation lock hook for next.js

Install

npm install @fatgy/use-navigation-lock

Usage

import {useNavigationLock} from '@fatgy/use-navigation-lock';

useNavigationLock(true);
//=> Show confirm dialog

useNavigationLock(false);
//=> Not show confirm dialog

API

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

2.0.0

5 months ago

1.0.2

8 months ago

1.0.1

9 months ago

1.0.0

9 months ago