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

147
Views
"TypeError: Cannot read properties of undefined (reading '0')" when accessing data from an array in React while retrieving data from react/redux

I am getting a weird error while using React and Redux

I access data from redux state using the following code:

const aboutGet = useSelector((state) => state.aboutGet);
const { loading, error, aboutData } = aboutGet;
console.log(aboutData); 

The output of the above is the console output as follows:

    [{…}]
    0:
    aboutcontent: "Test Data"
    createdAt: "2021-09-19T08:59:01.548Z"
    image: "Some Image"
    title: "Some new About"
    updatedAt: "2021-09-20T03:04:09.014Z"
    __v: 0
    _id: "6146fbd5f4720923359e3338"
    [[Prototype]]: Object
    length: 1

I now start by trying to access the _id from the above by using the following lines of code:

const aboutId = aboutData[0]._id;
console.log(aboutId);

This gives me the following error:

"TypeError: Cannot read properties of undefined (reading '0')"

Can someone please help and let me know where I am going wrong and what I need to do to access the data inside aboutData.

Many thanks and regards Teejay

about 4 years ago · Juan Pablo Isaza
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!