@ian_test_nooks/use-preventleave

1.0.0 • Public • Published

@ian_test_nooks/use-preventleave

React Hook to prevent Page before Leave

npm i @ian_test_nooks/use-preventleave

const { enablePrevent, disablePrevent } = usePreventLeave();

import usePreventLeave from "@ian_test_nooks/use-preventleave";

const App = () => {
  const { enablePrevent, disablePrevent } = usePreventLeave();
  return (
    <div className="App">
      <div>Hi</div>
      <button onClick={enablePrevent}>Protect</button>
      <button onClick={disablePrevent}>unProtect</button>
    </div>
  );
};

Readme

Keywords

Package Sidebar

Install

npm i @ian_test_nooks/use-preventleave

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

1.55 kB

Total Files

4

Last publish

Collaborators

  • iian