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

150
Views
React - Read properties of undefined (reading 'type')

I am having a problem because I have a read properties of undefined (reading 'type') error that I cannot resolve. I receive the data from my API but the value of 'type' and undefined and I don't understand why? Someone would have any idea ?

export function picture(object) {
  const result = {
    type: 'photo',
    title: object.title,
    photoURL: object.url,
    owner: object.author_name,
    uploadDate: object.upload_date,
    html: object.html,
  };
  return result;
}
export function video(object) {
  const result = {
    type: 'video',
    title: object.title,
    uploadDate: object.upload_date,
    photoURL: object.thumbnail_url,
    owner: object.author_name,
    html: object.html,
    duration: object.duration,
  };
  return result;
}

export function filterData(object) {
  console.log(object);
  if (object.type === 'video') {
    return video(object);
  } else if (object.type === 'photo') {
    return picture(object);
  }
}

console.log(object)

API response

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!