@am-hooks/use-beforeunload
v1.0.0
Published
A notification is displayed if the user wants to leave the page without saving the changes.
Downloads
6
Readme
usePreventLeave
유저가 변경 사항을 저장하지 않고 페이지를 벗어나가길 원할 때 알림 메시지 표시
Installation
yarn
yarn add @am-hooks/use-preventLeave
npm
npm i @am-hooks/use-preventLeave
Usage
import usePreventLeave from "@am-hooks/use-preventLeave";
const App = () => {
const { enablePrevent, disablePrevent } = usePreventLeave();
return (
<>
<button onClick={enablePrevent}>protect</button>
<button onClick={disablePrevent}>unprotect</button>
</>
)
}