1.0.0 • Published 6 years ago

redux-simple-flash v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Redux Simple Flash

A simple flash message plugin for react and redux.

Integration

1 npm install 'redux-simple-flash' --save

2 Add redux-thunk middleware

npm install 'redux-thunk' --save
 import reduxThunk from 'redux-thunk'

 const createStoreWithMiddleware = applyMiddleware(reduxThunk)(createStore)
 const store = createStoreWithMiddleware()

3 Add the reducer to your root reducer

import { flashReducer } from 'redux-simple-flash'

const rootReducer = combineReducers({
  flash: flashReducer
})

export default rootReducer

4 Import and use action creator in your own actions

import { addMessage } from 'redux-simple-flash'

...
dispatch(addMessage("success", "User created!"))
...