with-notifications-system
v0.0.2
Published
Provides [react-notification-system](https://github.com/igorprado/react-notification-system) as a [higher-order-component](https://facebook.github.io/react/docs/higher-order-components.html).
Downloads
2
Readme
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)