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

169
Views
Cómo rellenar previamente los datos en el formulario y el formulario es editable mediante el componente funcional de reacción

Esta es mi descripción general del código del archivo reaccionar jsx

 const [name, setName] = useState(""); // and the prefield data which I want to be prefield is commit from API which is const nameFromApi = userDatails?.name; // Here is my function return JSX <input defaultValue={nameFromApi} value={name} onChange={e => setName(e.target.value)} />
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Puede inicializar el name con el valor para que sea el valor inicial de la entrada

const [name, setName] = useState(userDatails?.name);

<input value={name} onChange={e => setName(e.target.value)} />

about 4 years ago · Juan Pablo Isaza Report

0

Si entiendo correctamente, está recibiendo una respuesta de api que es userDatails y desea que su entrada tenga el valor si userDatails es su valor inicial.

puedes hacer algo como esto

 const [name, setName] = useState(""); useEffect(()=>{ //call your api and get value ... setName(userDatails?.name) },[])
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!