@bufferapp/notifications
Create a notification that disappears after 5 seconds or when the user closes it.
Setup
Add Reducer And Middlware To Store
import {
createStore,
combineReducers,
applyMiddleware,
} from 'redux';
import { middleware, reducer } from '@bufferapp/notifications';
const store = createStore(
combineReducers({
notifications: reducer,
}),
{},
applyMiddleware(middleware),
);
Add Notifications Within The React Redux Provider
import { Provider } from 'react-redux';
import Notifications from '@bufferapp/notifications';
<Provider store={store}>
<Notifications />
</Provider>
API
createNotification
notificationType string the type of notification to display, success
or error
controls the icon
message string the message to display on the notification
import { actions } from '@bufferapp/notifications';
store.dispatch(actions.createNotification({
notificationType: 'success',
message: 'Hooray! A notification appears!',
}));