npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-redux-notifier

v0.1.7

Published

Notifier that based on react and redux.

Readme

react-redux-notifier

React-redux-notifier helps you show your own notification and customize them.

Installation

To install the stable version:

npm install --save react-redux-notifier

Add notifier to your project.

Add add Reducer to combineReducers function:

import { combineReducers } from 'redux';
import { Reducer } from 'react-redux-notifier';

export default combineReducers({
    notifier: Reducer
})

Add Notifications to Component:

import React, { Component } from 'react';
import { Notifications } from 'react-redux-notifier';

export default class Demo extends Component {
    render () {
        return ( <Notifications nKey="some.key" /> );
    }
}

Create and delete Notifications.

There are four kinds of notifications:

  1. NOTIFICATION_INFO
  2. NOTIFICATION_SUCCESS
  3. NOTIFICATION_WARNING
  4. NOTIFICATION_ERROR

And actions for create them:

  1. ADD_INFO(key, message, options)
  2. ADD_SUCCESS(key, message, options)
  3. ADD_WARNING(key, message, options)
  4. ADD_ERROR(key, message, options)

Also you can clear notification store:

  1. CLEAR_BY_KEY(key) - delete notification by key
  2. CLEAR() - clean the whole notifications store

Create and delete the notification:

export default class Demo extends Component {
    componentWillMount() { 
        this.props.dispatch(ADD_INFO("demo.key", "It's info notification."));
        this.props.dispatch(CLEAR_BY_KEY("demo.key"));
    }
}

Also, you can specify OPTIONS like "hideAfter | ha" and "showAfter | sa":

    this.props.dispatch(ADD_SUCCESS("demo.key.ha", "It's third info notification that will disappear after 3 seconds.", {ha: 3000}));
    this.props.dispatch(ADD_WARNING("demo.key.sa", "It's third info notification that appear after 3 seconds.", {sa: 3000}));

Customization.

Set global settings for each kind of notification:

import { Actions, Kinds } from 'react-redux-notifier';
const CUSTOMIZE = Actions.CUSTOMIZE;
// or
import { CUSTOMIZE } from 'react-redux-notifier';

export default class Demo extends Component {
    componentWillMount() { 
        this.props.dispatch(CUSTOMIZE({
            kind: Kinds.NOTIFICATION_INFO,
            className: "alert alert-info",
            style: {'fontSize': '18px'}
        }));
    }
}

You can set global "className" and "style" for particular kind of notifications.

Notification Component.

Notification Component has several props like:

  1. nkey - that's key that you specify when to create an action.
  2. kind - that's a type of notification.
  3. style - style for notification.
  4. className - classes for notification.
  5. isUseDefSettings - specify if a component must use global settings (default = true).
  6. isShowMessage - specify if a component must show a message that you specify when to create an action (default = true).
    <Notifications nkey="demo.key"
        kind={Kinds.NOTIFICATION_ERROR}
        style={{background: 'red'}}
        className="error"
        isUseDefSettings={false}/>

Nested components:

    <Notifications nkey="demo.key"
        kind={Kinds.NOTIFICATION_INFO}
        isShowMessage={false}
        >
            <p>It is nested element.</p>
        </Notifications>

Full example.

import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import { Provider, connect } from 'react-redux';
import { createStore, compose, bindActionCreators, combineReducers, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import {
    Row,
    Col,
    Navbar
} from 'react-bootstrap';
import {
    Notifications,
    Reducer,
    Actions,
    Kinds
} from 'react-redux-notifier';

/* ***** DEMO COMPONENT ***** */

class Demo extends Component {
    constructor() {
        super()
    }

    componentWillMount() {

        this.props.actions.CUSTOMIZE({
            kind: Kinds.NOTIFICATION_ERROR,
            className: "alert alert-danger",
            style: {'fontSize': '18px'}
        });
        this.props.actions.CUSTOMIZE({
            kind: Kinds.NOTIFICATION_SUCCESS,
            className: "alert alert-success"
        });
        this.props.actions.CUSTOMIZE({
            kind: Kinds.NOTIFICATION_INFO,
            className: "alert alert-info"
        });
        this.props.actions.CUSTOMIZE({
            kind: Kinds.NOTIFICATION_WARNING,
            className: "alert alert-warning"
        });

        this.props.actions.ADD_INFO("demo.key", "It's info notification.");
        this.props.actions.ADD_ERROR("demo.key", "It's second info notification.");
        this.props.actions.ADD_SUCCESS("demo.key.ha", "It's third info notification that will disappear after 3 seconds.", {ha: 3000});
        this.props.actions.ADD_WARNING("demo.key.sa", "It's third info notification that appear after 3 seconds.", {sa: 3000});
    }

    render() {
        return (
            <div className="container">
                <Navbar>
                    <Navbar.Header>
                        <Navbar.Brand>
                            React Redux Notifier
                        </Navbar.Brand>
                        <Navbar.Toggle />
                    </Navbar.Header>
                </Navbar>
                <Row>
                    <Col xs={12}>
                        <Notifications nkey="demo.key"
                                       kind={Kinds.NOTIFICATION_INFO}>
                            <p>It is nested element.</p>
                        </Notifications>
                        <Notifications nkey="demo.key"
                                       kind={Kinds.NOTIFICATION_ERROR}
                                       style={{background: 'red'}}
                                       className="super"
                                       isUseDefSettings={true}/>
                        <Notifications nkey="demo.key.ha"
                                       kind={Kinds.NOTIFICATION_SUCCESS}/>
                        <Notifications nkey="demo.key.sa"
                                       kind={Kinds.NOTIFICATION_WARNING}/>
                    </Col>
                </Row>
            </div>
        );
    }
}

function mapStateToProps(store, props) {
    return {notifier: store.notifier};
}

function mapDispatchToProps(dispatch) {
    return {actions: bindActionCreators(Actions, dispatch)};
}

const DemoDecorated = connect(mapStateToProps, mapDispatchToProps)(Demo);

/* ***** STORE ***** */

const createStoreWithMiddleware = compose(
    applyMiddleware(thunk)
)(createStore);

const store = createStoreWithMiddleware(combineReducers({
    notifier: Reducer
}));

/* ***** RENDER ***** */

ReactDOM.render(
    <Provider store={store}>
        <DemoDecorated />
    </Provider>,
    document.getElementById('demo')
)