A react notification library
npm install --save renotify-react
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>
)
}
MIT © Augani