@practical-react-hooks/use-notification

1.0.1 • Public • Published

@practical-react-hooks/use-notification

React Hook to make web browser notification to user

Installation

yarn

yarn add @practical-react-hooks/use-notification

npm

npm i @practical-react-hooks/use-notification

Usage

import React from "react";
import useNotification from "@practical-react-hooks/use-notification";

const App = () => {
  const triggerNotif = useNotification("Can you love me?", {body: "I love you"});
  return (
    <div className="App">
      <button onClick={triggerNotif}>Hello</button>
    </div>
  );
};

Arguments

Argument Type Description Required
title string Notification title yes
options objects Notification options in notification API (https://developer.mozilla.org/en-US/docs/Web/API/notification) no

Return

Return value Type Description
fireNotif Function Function to make Notification

/@practical-react-hooks/use-notification/

    Package Sidebar

    Install

    npm i @practical-react-hooks/use-notification

    Weekly Downloads

    0

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    2.31 kB

    Total Files

    4

    Last publish

    Collaborators

    • octo908