use-browser-notifications
v0.3.2
Published
React Hook for Browser Notifications
Downloads
4
Readme
use-browser-notifications
Made with create-react-library
Install
$ npm install --save use-browser-notifications
Or using Yarn with
$ yarn add use-browser-notifications
Usage
import React from 'react'
import { useBrowserNotifications } from 'use-browser-notifications';
function App() {
const { show } = useBrowserNotifications({
title: 'test notification',
body: 'Hello world!',
});
return (
<div className="App">
<header className="App-header">
<p>
Use Browser Notifications
</p>
<div className="buttons">
<button className="button" onClick={show}>Show Notification</button>
</div>
</header>
</div>
);
}
export default App;
Local development
First install all the node dependencies using Yarn
$ yarn
Then run the start
script
$ yarn start
License
MIT © andreasonny83