1.4.1 • Published 3 years ago

wf-react-simple-toast v1.4.1

Weekly downloads
22
License
MIT
Repository
github
Last release
3 years ago

wf-react-simple-toast

npm.io

Documentation

Installation

npm

npm install wf-react-simple-toast --save

yarn

yarn add wf-react-simple-toast

PlayGround

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.

TypeDefaultRequired
number2000No
1.4.1

3 years ago

1.4.0

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.0

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago