1.0.0 • Published 3 years ago

@ziphooks/use-before-top v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@ziphooks/use-before-top

React Hook for detecting if mouse is located at browser's top bar. You can use this React Hook for prevent exiting without saving.

Installation

yarn

yarn add @ziphooks/use-before-top

npm

npm i @ziphooks/use-before-top

Usage

import React from "react";
import useBeforeTop from "@ziphooks/use-before-top";

function App() {
  useBeforeTop(() => alert("Are you saved some stuffs?"));
  return <h1>Some Stuffs</h1>;
};

Arguments

ArgumentTypeDescriptionrequired
onBeforeBooleanA boolean that means if requesting API is overtrue