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

263
Visualizações
How to resolve Type 'void' is not assignable to type 'ReactNode' issue in TSX

I am trying to iterate the Mui component MenuItem by using forEach loop but I am getting Type 'void' is not assignable to type 'ReactNode' error. Here is my code snippet-

      <TableCell>
        <Typography>expiry</Typography>
        <Select variant="outlined" sx={{ width: '100%', height: 35, borderRadius: 2 }}>
        { groupData.forEach((option) => (
          <MenuItem key={option.expiry} value={option.expiry}>
            {option.expiry}
          </MenuItem>
          ))}
        </Select>
      </TableCell>

Thanks in Advance

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

forEach returns void. To display a list of items in JSX, you use the map method of the array, which will convert the items of the array into some other form. For example:

const squares = (
  <ul>
    {[1, 2, 3, 4].map((value) => (
      <li key={value}>{value}</li>
    ))}
  </ul>
);

Learn more about lists in react here

For your case, you can do the following:

<TableCell>
  <Typography>expiry</Typography>
  <Select variant="outlined" sx={{ width: '100%', height: 35, borderRadius: 2 }}>
  {groupData.map((option) => (
    <MenuItem key={option.expiry} value={option.expiry}>
      {option.expiry}
    </MenuItem>
  ))}
  </Select>
</TableCell>
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