react-redux-toasts
v1.0.0
Published
react-redux-toasts React component
Downloads
25
Readme
react-redux-toasts
react-redux-toasts
is a React toast implemented with react-redux-toastr.
Installation
npm install --save react-redux-toasts
import {createStore, combineReducers} from 'redux'
import {toastReducer} from 'react-redux-toasts'
const reducers = {
toastr: toastReducer
// ... other reducers ...
}
const reducer = combineReducers(reducers)
const store = createStore(reducer)
import {Provider} from 'react-redux'
import MToastr from 'react-redux-toasts'
<Provider store={store}>
... other things
<MToastr />
</Provider>
import React, {Component} from 'react'
import {mToast} from 'react-redux-toasts'
export class YourComponent extends Component {
render() {
return (
<div>
<button onClick={() => mToast.success({text:"Hello react !"})} type="button">Toast</button>
</div>
)
}
}
Run a local demo
git clone https://github.com/djfr101/react-redux-toasts.git
cd react-redux-toasts
npm install
npm start
open your browser at http://localhost:3000