1.0.1 • Published 4 years ago

renotify-react v1.0.1

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

Renotify-react

A react notification library

NPM JavaScript Style Guide

Live examples

Renotify

Install

npm install --save renotify-react

Usage

Make sure to import the default export and add it to the root of your react components.

import React, { Component } from 'react'

import Renotify from 'renotify-react'
import 'renotify/dist/index.css'

class Example extends Component {
  render() {
    return (
    <div>
    {/*Other components*/}
    <Renotify />
    </div>
)
  }
}

Then you can import the notify object anywhere in your app and in any component to use it

import {notify} from 'renotify-react'

function Example(){

  const notification = ()=>{
    notify.show({
          title: "Kofi is online!",
          subTitle: "Want to chat with him?",
          type: "success",
          style: {
                //css in js style
            },
          confirm: true,
          confirmText: "Yes",
          cancelText: "No",
          confirmAction: function(){
              //What to do when user clicks ok
          }
    })
  }
  return(
  <div>
  {/*  Normal codes*/}
  </div>
)
}

Example

npm.io

License

MIT © Augani