@am-hooks/use-beforeunload

1.0.0 • Public • Published

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> 
    </>
  )
}



Readme

Keywords

Package Sidebar

Install

npm i @am-hooks/use-beforeunload

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

1.68 kB

Total Files

4

Last publish

Collaborators

  • wam-6577