redux-messenger
Getting Started
Install
npm install -S redux-messenger
Setup
Add messenger reducer
To add the redux-messenger
reducer to your project, import the reducer module and combine it with your other reducers.
todos counter messenger // <- ADD REDUCER
Add UI Components
The UI components (AlertComponent
, ModalComponent
, and ToastComponent
) can be imported anywere in you application and are responsible for displaying messages to your users. Here is an example of integrating redux-messenger
using react-redux
.
;;; ; const App = { const actions messengerState = props; return <div> <AlertComponent clearAlert=actionsclearAlert alert=messengerStatealert /> <ModalComponent onClose=actionsremoveModal modal=messengerStatemodal /> <ToastComponent removeToast=actionsremoveToast toast=messengerStatetoast /> </div> ;} const mapStateToProps = { return messengerState: ;}; const mapDispatchToProps = { return actions: ;}; mapStateToProps mapDispatchToPropsApp;