@bro95-hooks/use-before-leave
Installation
npm
npm i @bro95-hooks/use-before-leave
Usage
import React from "react";
import useBeforeLeave from "@bro95-hooks/use-before-leave";
function App() {
const beforeLeave = () => console.log("User is leaving...");
useBeforeLeave(beforeLeave);
return <h1>Hello Nooks</h1>;
}
Arguments
Argument | Type | Description | Required |
---|---|---|---|
onBeforeLeave | function | Function to be called when the mouse leaves the document | yes |