wf-react-simple-toast
v1.4.1
Published
Simple toast component for React library.
Readme
wf-react-simple-toast

Documentation
Installation
npm
npm install wf-react-simple-toast --saveyarn
yarn add wf-react-simple-toastPlayGround
Example
import React from 'react'
import Toast from 'wf-react-simple-toast'
const App = () => {
React.useEffect(() => {
for (let i = 1, magic = Promise.resolve(); i < 8; i++) {
magic = magic.then(
() =>
new Promise(resolve =>
setTimeout(() => {
Toast.toastMessage("toast " + i)
resolve()
}, Math.random() * 1000)
)
)
}
}, [])
const handleClick = () => {
Toast.toastMessage('Hello I am a toast!', 1500)
}
return (
<React.Fragment>
<Toast timeToClose="3000" />
<h1 onClick={() => handleClick()}>Click Me to summon the toast</h1>
</React.Fragment>
)
}timeToClose
Used to set the Toast default fading time.
| Type | Default | Required | | ---------- | -------- | -------- | | number | 2000 | No |
