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

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.1.61latest

Version History

VersionDownloads (Last 7 Days)Published
2.1.61
2.1.51
2.0.51
2.0.01
1.0.01

Package Sidebar

Install

npm i reactjs-push-notification

Weekly Downloads

5

Version

2.1.6

License

MIT

Unpacked Size

25.3 kB

Total Files

21

Last publish

Collaborators

  • siamahnaf