@ian_test_nooks/use-beforeleave

1.0.2 • Public • Published

@ian_test_nooks/use-beforeleave

React Hook to check mouse position when mouse leave element or area

npm i @ian_test_nooks/use-beforeleave

useBeforeLeave(callback function after mouse leave); .. const { clientY } = event; if (clientY <= 0) { onBefore(); } ..

import useBeforeLeave from "@ian_test_nooks/use-beforeleave";

const App = () => {
  const begForLife = () => console.log("Please dont leave");
  useBeforeLeave(begForLife);

  return (
    <div className="App">
      <div>Hi</div>
    </div>
  );
};

Readme

Keywords

Package Sidebar

Install

npm i @ian_test_nooks/use-beforeleave

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

1.79 kB

Total Files

4

Last publish

Collaborators

  • iian