React hook to use the Notifications API
npm install --save @21kb/react-notification-hook
yarn add @21kb/react-notification-hook
import useNotification from '@21kb/react-notification-hook';
const Component = () => {
const notify = useNotification({
title: '💡 Test notification!',
options: {
dir: 'rtl',
}
});
return (
<button onClick={notify()}>Notify me!</button>
);
};
NOTE: useNotification
assumes the user has already granted permissions.
MIT