with-notifications-system

0.0.2 • Public • Published

with-notification-system

Provides react-notification-system as a higher-order-component.

Installation

yarn add with-notifications-system

Usage

Wrap your app in a <NotificationSystemProvider /> see the react-notification-system docs for more details on where to place this element

// index.js
import { render } from 'react-dom';
import { withNotificationSystem } from 'with-notification-system';

const rootElement = document.getElementById('root');

render(<NotificationSystemProvider><App /></NotificationSystemProvider>, rootElement);

Then anywhere you want a component to be able to create notifications

import React from 'react';
import { withNotificationSystem } from 'with-notification-system';

export class SuccessButton extends React.Component {
  handleClick = () =>
    this.props.notifications.create({});
    
  render() {
    return <button onClick={this.handleClick}>Succeed</button>
  }
}

export default withNotificationSystem(SuccessButton)

Readme

Keywords

none

Package Sidebar

Install

npm i with-notifications-system

Weekly Downloads

0

Version

0.0.2

License

MIT

Last publish

Collaborators

  • dean177