react-mini-toaster

React-Mini-Toaster allow you to add notification to your app with ease.

Usage no npm install needed!

<script type="module">
  import reactMiniToaster from 'https://cdn.skypack.dev/react-mini-toaster';
</script>

README

react-mini-toaster

React-Mini-Toaster allow you to add notification to your app with ease.

NPM JavaScript Style Guide

Project Demo

Install

npm install --save react-mini-toaster

Usage

import React, { Component } from 'react'

import Toaster from 'react-mini-toaster'

export default class App extends Component {
  constructor(props){
    super(props);
    this.state={
      isVisible: true
    }
  }

  handleOnClick=()=>{
    this.setState({
      isVisible: false
    })
  }
  render () {
    const { isVisible } = this.state;
    return (
      <div>
        <Toaster 
          type={"error"}
          header={"Error"}
          message={"Server is not responding"}
          isVisible={isVisible}
          onClick={this.handleOnClick} 
        />
      </div>
    )
  }
}

License

MIT © sagarbajpai