“reagieren -Toastify” Code-Antworten

Reaktieren Sie den NPM an

$ npm install --save react-toastify
$ yarn add react-toastify
Naughty Newt

reagieren -Toastify

import React from 'react'
import './App.css'
import { toast } from 'react-toastify'
import 'react-toastify/dist/ReactToastify.css'
toast.configure()

function App () {
  const notify = () => {
    toast('Default!', { position: toast.POSITION.TOP_LEFT })
    toast.success('Success!', {
      position: toast.POSITION.TOP_CENTER,
      autoClose: 8000
    })
    toast.info('Info!', {
      position: toast.POSITION.TOP_RIGHT,
      autoClose: false
    })
    toast.warn({
      position: toast.POSITION.BOTTOM_LEFT
    })
    toast.error('Error!', { position: toast.POSITION.BOTTOM_CENTER })
    toast('Wow so easy !', { position: toast.POSITION.BOTTOM_RIGHT })
  }
  return (
    <div className='App'>
      <button onClick={notify}>Notify !</button>
    </div>
  )
}
export default App
Abhishek

reagieren Sie Toastifizierung

  import React from 'react';

  import { ToastContainer, toast } from 'react-toastify';
  import 'react-toastify/dist/ReactToastify.css';
  
  function App(){
    const notify = () => toast("Wow so easy!");

    return (
      <div>
        <button onClick={notify}>Notify!</button>
        <ToastContainer />
      </div>
    );
  }
Uptight Unicorn

Ähnliche Antworten wie “reagieren -Toastify”

Fragen ähnlich wie “reagieren -Toastify”

Weitere verwandte Antworten zu “reagieren -Toastify” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen