@customhooks/use-before-leave

1.0.1 • Public • Published

@customhooks/use-before-leave

React Hook to execute a function when the mouse leaves the page.

Installaction

npm install @customhooks/use-before-leave

or

yarn add @customhooks/use-before-leave

Usage

useBeforeLeave() have a one argument like this :
useBeforeLeave(onBeforeLeave)

onBeforeLeave is must be function.

import React from "react";
import useBeforeLeave from "@nooks/use-before-leave";

function App() {
    const beforeLeave = () => console.log("Leaving Now");
    useBeforeLeave(beforeLeave);

    return <h1>Hello World!</h1>;
}

Package Sidebar

Install

npm i @customhooks/use-before-leave

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

1.91 kB

Total Files

4

Last publish

Collaborators

  • signloper