1.0.3 • Published 4 years ago

react-toast-notifier v1.0.3

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

react-toast-notifier CI status

A simple and easy to use toast notification module for react.

Installation

This is a React.js module available through the npm registry. Installation is done using the npm install command:

$ npm install react-toast-notifier

Example & Usage (Success)

import React, { Fragment } from 'react';
import Notification, { notifier } from 'react-toast-notifier';

// for success message
const NotificationButton = () => {
  return (
    <Fragment>
      <Notification />
      <button onClick={() => {
        notifier({ type: "success", message: "Success message", autoDismissTimeout:5000 });
      }}>Toast</button>
    </Fragment>
  );
};

export default NotificationButton;

Example & Usage (Error)

import React, { Fragment } from 'react';
import Notification, { notifier } from 'react-toast-notifier';

// for error message
const NotificationButton = () => {
  return (
    <Fragment>
      <Notification />
      <button onClick={() => {
        notifier({ type: "error", message: "Error message", autoDismissTimeout:5000 });
      }}>Toast</button>
    </Fragment>
  );
};

export default NotificationButton;

Example & Usage (Warning)

import React, { Fragment } from 'react';
import Notification, { notifier } from 'react-toast-notifier';

// for warning message
const NotificationButton = () => {
  return (
    <Fragment>
      <Notification />
      <button onClick={() => {
        notifier({ type: "warning", message: "Warning message" });
      }}>Toast</button>
    </Fragment>
  );
};

export default NotificationButton;

Note

Author

Rohan Shukla GitHub LinkedIn

License

© Licensed under the MIT License.