Closed pastinepolenta closed 6 years ago
Looking at the code I found out the following:
notifications
property is indeed required and must correspond to the Reducerstate.notifs
hence your reducer must be called notifs
Additional info:
mapDispatchToProps
you can write in your component (or component container)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>
I could not find any documentation about the fact that the
Notifs
component requires a propertynotifications
. Can you please elaborate ?