indexiatech / re-notif

Redux & React based Notifications center.
http://indexiatech.github.io/re-notif
BSD 3-Clause "New" or "Revised" License
148 stars 45 forks source link

Failed prop type: The prop `notifications` is marked as required in `Notifs`, but its value is `undefined` #65

Closed pastinepolenta closed 6 years ago

pastinepolenta commented 6 years ago

I could not find any documentation about the fact that the Notifs component requires a property notifications. Can you please elaborate ?

pastinepolenta commented 6 years ago

Looking at the code I found out the following:

Additional info:

const mapDispatchToProps = (dispatch) => {
    const { notifSend } = notifActions;
    return {
        notifSend: (message, kind = 'success', dismissAfter = 5000) => {
            dispatch(notifSend({ // note that this is the notifSend imported from the library
                message,
                kind,
                dismissAfter
            }));
        }
    }
}

and use the prop in your JSX like

const { notifSend } = props;
<button onClick={ () => {
    notifSend('Something bad', 'danger');
    notifSend('Something good', 'success');
}}>CLICK</button>