1.0.0 • Published 4 years ago

react-redux-toasts v1.0.0

Weekly downloads
7
License
MIT
Repository
github
Last release
4 years ago

react-redux-toasts

npm package

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

1.0.0

4 years ago