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

278
Views
Actualización de una matriz en Firestore: TypeError no detectado: las opciones no son una función

Estoy tratando de actualizar estas options en Firestore:

ingrese la descripción de la imagen aquí

Para editar la category , la actualiza con éxito. Pero para la matriz de options , este es el error que muestra:

TypeError no detectado: las opciones no son una función

 const [category, setCategory] = useState([]); //useEffect to get all of the categories const [options, setOptions] = useState([]); const [edit, setEdit] = useState(); const handleSubmit = async (e) => { e.preventDefault(); const ref = doc(db, "category", state); await updateDoc(ref, { category: edit, }); console.log("updated"); };

formularios

Estoy usando un defaultValue para mostrar el valor inicial que se guardó en Firestore.

 {category && category.map((category, index) => ( <form onSubmit={handleSubmit}> <TextField defaultValue={category.cat} type="text" value={categoryEdit} fullWidth onChange={(e) => setCategoryEdit(e.target.value)} /> {category.options.map((i) => ( <TextField type="text" defaultValue={i} variant="outlined" fullWidth value={options(i)} onChange={(e) => setOptions(e.target.value(i))} /> ))} </> )} <Button type="submit">Submit</Button> </form> ))}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Esto no tiene nada que ver con la actualización de Firestore.

options es una matriz, pero aquí la estás llamando como una función usando paréntesis:

 value={options(i)}

Si desea indexar la matriz, use corchetes, no paréntesis.

 value={options[i]}
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!