usePageLeave
React sensor hook that tracks when mouse leaves the page
Usage
function Demo() {
const isLeft = usePageLeave();
return <div>isLeft: {JSON.stringify(isLeft)}</div>;
};
API
usePageLeave
Returns
boolean
: whether the mouse leave page
Arguments