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

220
Visualizações
How to solve TypeError: Cannot read properties of undefined (reading '0') in Reactjs?

This is the image of error i am encountering here

enter image description here

All the codes can be found here: https://github.com/callmebhawesh/react/ I thought it's better to provide github link so that you can run and see instead of writing everything here.

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

0

Change the Todos line in your App.js

<Todos todo={todos} />

To this one

<Todos todos={todos} />

Basically you're trying to access todos[0] but you're passing a prop called todo not todos, so when doing todos[0] is trying to access an undefined prop that does not exist.

about 4 years ago · Juan Pablo Isaza Relatório

0

From your code, you're destructuring the wrong item. In your <Todos /> component, you're passing in the first Todo item in the list. Each todo has the following properties:

  • sno
  • title
  • desc

In your <Todo /> component, you're trying to extract out a "todo" property, and that doesn't exist in your object. To get your title, you'd destructure out the title from your Todo object.

const Todo = ({title}) => {
    // Render here
}

You can extract the other properties as needed.

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