1.0.0 • Published 4 years ago

@custom_react_hook/use-notification v1.0.0

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

@custom_react_hook/use-notification

React Hook to use Notification.
This function need to allow browser's Notification Permission.

Installation

yarn

yarn add @custom_react_hook/use-notification

npm

npm i @custom_react_hook/use-notification

Usage

import React from "react";
import useNotification from "@custom_react_hook/use-notification";
function App() {
  const triggerNotif = useNotification("Notification TEST", {
    body: "Notification content"
  });
  return <button onClick={triggerNotif}>Make a Notification</button>;
}

Arguments

ArgumentTypeDescriptionRequired
titlestringThe title of Notificationyes
optsJSONNotification's options https://developer.mozilla.org/ko/docs/Web/API/notificationyes

Return

Return valueTypeDescription
FunctionFunctionA Function can make a notification