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

244
Views
¿Cómo actualizar la interfaz de usuario después de disminuir la cantidad del backend en reaccionar JS?

Cuando vuelvo a cargar la página, la cantidad se actualiza, pero hasta que la página vuelve a cargar, la cantidad no se actualiza en la interfaz de usuario. Por otro lado, mi base de datos disminuye la cantidad.

 const StockUpdate = () => { const { id } = useParams(); const [stockUpdate, setStockUpdate] = useState({}); useEffect(() => { const getItemById = async () => { const url = `http://localhost:8000/inventory/${id}` const { data } = await axios.get(url); setStockUpdate(data); } getItemById(); }, [id]); const handleDeliveryButton = () => { console.log(stockUpdate) const item = stockUpdate; const url = `http://localhost:8000/inventory/${id}`; fetch(url, { method: 'PUT', headers: { 'Content-type': 'application/json', }, body: JSON.stringify(item), }) .then(res => res.json()) .then(data => { console.log(data) }); toast('Stock quantity updated after delivery !!!!'); };
over 4 years ago · Santiago Trujillo
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!