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

213
Views
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 answers
Answer question

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 Report

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 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!