@feca-hooks/use-notification
v1.0.1
Published
React Hook to use browser notification easier.
Maintainers
Readme
@feca-hooks/use-notification
React Hook to use browser notification easier.
How to Install
yarn
yarn add @feca-hooks/use-notification
npm
npm i @feca-hooks/use-notification
Usage
Code
import React from "react";
import useNotification from "@feca-hooks/use-notification";
function App() {
const sendNotification = useNotification("Hello!");
return <button onClick={sendNotification}>Send Hello</button>;
}Arguments
| Argument | Type | Description | Required | | ------------ | -------- | --------------------------------------------------------------------------------------- | ------------ | | title | string | The text you want to notice. | yes | | options | object | Reference | no |
Return
| Return value | Type | Description | | ---------------- | -------- | ------------------------------------------------------------------------ | | sendNotification | function | If permission is granted, you can send notification using this function. |
