@ej-hooks/use-notification
React Hook to configure and display notification to user.
Installation
yarn
yarn add @ej-hooks/use-notification
npm
npm i @ej-hooks/use-notification
Usage
import React from 'react';
import useNotification from '@ej-hooks/use-notification';
function App() {
const triggerNotif = useNotification('title of notification', {
body: 'body of notification',
});
return <button onClick={triggerNotif}>Hello</button>;
}
Arguments
Argument | Type | Description | Required |
---|---|---|---|
title | string | Title of notification | yes |
options | object | An object containing the options of notification | no |