Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

383
Visualizações
TextField not editable due to Uncaught TypeError: is not iterable

I am pulling data from an API and appending it to TextFields where it is displayed. I need to be able to edit the data displayed in TextFields, but I a get this Uncaught TypeError: prev.fields is not iterable when I try to edit or add any text to the TextFields.

This is how the TextField is populated:

{details["groups"]?.map((group) => {
    return (
        {group["fields"]?.map((row, index) => {
            return (
                <TextField
                    value={row?.Value || ""}
                    onChange={(e) => {
                        setDetails((prev) => {
                            const update = [...prev.fields];
                            update[index] = {
                                ...update[index],
                                Value: e.target.value,
                            };
                            return { ...prev, fields: update };
                        });
                    }}
                    label={row["FieldName"]}
                />
            );
        })}
    );
})}

This is my API request:

const fetchDetails = async () => {
    setDetails(await fetch(`/fiscalyears/FY2023/intakes/${params.id}/details`)
        .then((response) => response.json()));
};

This is an example of my data:

{
  "groups": [
    "GroupName": "Solution Details",
    "GroupOrder": 1,
    "fields": [
      {
        "FieldId": 19,
        "FieldOrder": 1,
        "FieldName": "Requesting Organization",
        "FieldType": "Text",
        "Value": "IT",
        "Choices": [
          null
        ]
      }
    ]
  ]
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

This answer was provided by Chris G in his comment

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda