reactjs-push-notification
TypeScript icon, indicating that this package has built-in type declarations

2.1.6 • Public • Published

Reactjs Push Notifications

A solution for pushing browser web notification! reactjs-push-notification is an npm package that allows you to push notifications to the browser. It can be used with both Next.js and React.js. The package is easy to use and provides a variety of customization options.

Features

  • It is open source and licensed under the MIT license.
  • It is compatible with React.js 16.8+ and Next.js 9.5+.
  • It has been tested in Chrome, Firefox, and Safari.
  • It is well-documented and includes examples.

Installing

$ npm install reactjs-push-notification

Example

import { pushNotification, NotificationPrompt } from "reactjs-push-notification";

const Push = () => {
    const buttonClick = () => {
        pushNotification({
            title: "Warning",
            subtitle: "This is a subtitle!",
            message: "This is a long message!"
        });
    };
    return (
        <div className="page">
            <NotificationPrompt />
            <button onClick={buttonClick} className="button">
                Push Notifications
            </button>
        </div>
    );
};

export default Push;

Options

Name Is Required Default
title Required (String) Notification Title
subtitle Optional (String) Notification Subtitle
message Optional (String) Notification Message Body
onClick Optional (Function)
duration Optional (Number) Notification Duration Time

Stay in touch

Readme

Keywords

none

Package Sidebar

Install

npm i reactjs-push-notification

Weekly Downloads

1

Version

2.1.6

License

MIT

Unpacked Size

25.3 kB

Total Files

21

Last publish

Collaborators

  • siamahnaf