@custom_react_hook/use-notification

1.0.0 • Public • Published

@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

Argument Type Description Required
title string The title of Notification yes
opts JSON Notification's options https://developer.mozilla.org/ko/docs/Web/API/notification yes

Return

Return value Type Description
Function Function A Function can make a notification

Package Sidebar

Install

npm i @custom_react_hook/use-notification

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

2.53 kB

Total Files

4

Last publish

Collaborators

  • bluebug9965