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

115
Visualizações
ypeError: Cannot read properties of undefined (reading 'map')

im done it exactly like in the tutorial and mine is not working, i cant guess why, thanks for any help


import React from "react";
import Day from './Day';

function Month({ month }) {
    return (
        <div className="flex-1 grid grid-cols-7 grid-rows-5">
            {month.map((row, i) => (
                <React.Fragment key={i}>
                    {row.map((day, idx) => (
                        <Day day={day} key={idx} />
                    ))}
                </React.Fragment>
            ))}
        </div>
    )
}

export default Month;
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

The month or the row object are undefined in your code try optional chaining to make sure that your objects are not undefined or null.

import React from "react";
import Day from './Day';

function Month({ month }) {
    return (
        <div className="flex-1 grid grid-cols-7 grid-rows-5">
            {month?.map((row, i) => (
                <React.Fragment key={i}>
                    {row?.map((day, idx) => (
                        <Day day={day} key={idx} />
                    ))}
                </React.Fragment>
            ))}
        </div>
    )
}

export default Month;
about 4 years ago · Juan Pablo Isaza Relatório

0

You are probably mapping something that is not an array Be sure what you pass and read this page (https://www.w3schools.com/jsref/jsref_map.asp)

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