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

154
Views
Cómo conectar la salida API del resto del matraz para reaccionar y mostrar el resultado

Estoy haciendo inferencia usando la API de descanso de matraz y obtuve el resultado

 { result: { predictions: -3.4333341121673584 } }

omitiendo varios argumentos en la obtención como URL Obtuve el resultado anterior http://127.0.0.1:3000/predict?solute=CC(C)(C)Br&solvent=CC(C)(C)O Ahora quiero usar este resultado para usar en una aplicación de reacción.

He escrito el código a continuación

 import { useState, useEffect } from "react"; function App() { const [state, setState] = useState({}); useEffect(() => { fetch("api/") .then((response) => { if (response.status == 200) { return response.json(); } }) .then((data) => console.log(data)) .then((error) => console.log(error)); });

He escrito lo siguiente usando un tutorial en Internet. Soy nuevo en el uso de fetch API o Axios. Necesito ayuda para obtener este resultado en la aplicación de reacción

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

0

import { useState, useEffect } from "react"; function App() { const [data, setData] = useState(null); const [loading, setLoading = useState(true); const [error, setError] = useState(null); useEffect(() => { fetch("http://127.0.0.1:3000/predict?solute=CC(C)(C)Br&solvent=CC(C)(C)O") .then((response) => { if (response.status == 200) { return response.json(); } }) .then(setData) .catch(setError) .finally(() => setLoading(false)); }, []); if (loading) { return <p>Loading</p> } if (error) { return <p>{JSON.stringify(error)}</p> } return <p>{JSON.stringify(data)}</p> }
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!