Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

207
Views
¿Cómo dar un mensaje de brindis cuando el usuario agrega un elemento?
import React from 'react';

import { useForm } from "react-hook-form"; import {brindis} de 'react-toastify';

const AddStorage = () => { const { registro, handleSubmit } = useForm();

 const onSubmit = data => { console.log(data); const url = `https://desolate-springs-82685.herokuapp.com/storage`; fetch(url, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(data) }) .then(res => res.json()) .then(result => { console.log(result); toast('Congrats! You added an order'); }) }; return ( <div className='w-50 mx-auto mb-5 mt-5 pb-5 pt-5'> <h2 className='text-center mb-4' >Please add a Storage</h2> <form className='d-flex flex-column' onSubmit={handleSubmit(onSubmit)}> <input className='mb-2' placeholder='Photo URL' type="text" {...register("img")} /> <input className='mb-2' placeholder='Name' {...register("name", { required: true, maxLength: 20 })} /> <input className='mb-2' placeholder='Capacity' type="number and text" {...register("capacity")} /> <textarea className='mb-3' placeholder='Description' {...register("description")} /> <input className='btn-success mb-4' type="submit" value="Add Storage" /> </form> </div> );

};

exportar AddStorage predeterminado;

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

necesita agregar ToastContainer a su componente y luego simplemente usar la función de toast como esta:

 toast.success('YOUR MESSAGE',{TOAST CONFIG})
about 4 years ago · Juan Pablo Isaza Report

0

Primero debe importar ToastContainer de la biblioteca de paquetes de esta manera

 import { ToastContainer, toast } from 'react-toastify';

Lea más sobre el uso del componente ToastContainer en el enlace

ToastContainer es un contenedor, donde desea mostrar su mensaje de error, cómo usarlo

 import * as React from 'react'; import { ToastContainer, toast } from 'react-toastify'; const Articles = () => { const markAsHome = () => { toast.success(`Article successfuly defined as a recent article` ); } return ( <> <ToastContainer /> <button onClick={markAsHome}> Mark As Home </button> </> ); } export default Articles;
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!