1.3.1 • Published 7 years ago
@21kb/react-notification-hook v1.3.1
@21kb/react-notification-hook
React hook to use the Notifications API
Install
npm
npm install --save @21kb/react-notification-hookYarn
yarn add @21kb/react-notification-hookUsage
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.
License
MIT