🔔useNotification

March 16, 2020 · View on GitHub

Uses the Notification Browser API in hook form

Arguments

Returns

  • fireNotify: Function(): Asks the user to allow notifications

Usage

import { useNotification } from 'react-recipes';

const App = () => {
  const triggerNotif = useNotification('hello world', {
    dir: 'rtl',
    body: 'Nice!',
  });

  return (
    <div className="App">
      <button onClick={triggerNotif}>Hello</button>
    </div>
  );
};