reactjs-toastr

1.1.0 • Public • Published

About

Toastr for ReactJS. Lightweight library. Easy to use.

Installation

Install via NPM

 
npm install reactjs-toastr --save
 

Example (Live Demo)

Include in React Component file

 
import React from 'react';
import { connect } from 'react-redux';
import toastr from 'reactjs-toastr';
import 'reactjs-toastr/lib/toast.css';
 
const mapStateToProps = state => ({ 
    
});
 
const mapDispatchToProps = dispatch => ({
    
});
 
class MyComponent extends React.Component {
    constructor() {
        super();
    }
 
    componentDidMount() {
 
    }
 
    render() {
        return (
            <div>
                <p onClick={()=>toastr.success('Success Message', 'Title', {displayDuration:3000})}>Show Success Message</p>
                <p onClick={()=>toastr.info('Info Message', '', {displayDuration:0})}>Show Info Message</p>
                <p onClick={()=>toastr.error('Error Message', 'Title')}>Show Error Message</p>
                <p onClick={()=>toastr.warning('Success Message', '', {width:'600px'})}>Show Warning Message</p>
            </div>
        );
    }
}
 
export default connect(mapStateToProps, mapDispatchToProps)(MyComponent);
 

Any issue or want more features? Contact me!

This module has been tested under limited scenarios. If you find any issue please feel free to report via one of the below platforms:

Email: harshdoshi999@gmail.com | Skype: harshxxx3

Package Sidebar

Install

npm i reactjs-toastr

Weekly Downloads

193

Version

1.1.0

License

MIT

Unpacked Size

6.59 kB

Total Files

5

Last publish

Collaborators

  • harshdoshi999