“Bereaksi Toastify” Kode Jawaban

Bereaksi Toastify

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

Bereaksi Toastify

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>
    );
  }
Dev Mahir

bereaksi -toasifikasi

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

Bereaksi Toastify tidak memiliki desain

  import React, { Component } from 'react';
  import { ToastContainer, toast } from 'react-toastify';
  import 'react-toastify/dist/ReactToastify.css';
  // minified version is also included
  // import 'react-toastify/dist/ReactToastify.min.css';

  class App extends Component {
    notify = () => toast("Wow so easy !");

    render(){
      return (
        <div>
        <button onClick={this.notify}>Notify !</button>
          <ToastContainer />
        </div>
      );
    }
  }
Hungry Hippopotamus

Bereaksi Toastify

  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

Jawaban yang mirip dengan “Bereaksi Toastify”

Pertanyaan yang mirip dengan “Bereaksi Toastify”

Lebih banyak jawaban terkait untuk “Bereaksi Toastify” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya