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

71
Views
Array Prop Undefined - Mapping Array In Props

I am expecting to map over an array, and pass the data to a child component. The undesired outcome is it reads as undefined.

Parent Component:

import Tier from "./tier";
const data = [
  {
    title: "SAVER SALLY",
    subtitle: "22,000rmb/month",
    list: [
      "Income Tax: 3,295",
      "Income Tax: 3,295",
    ],
    bottom: {
      title: "Total Yearly Savings:",
      centralNumber: "144,480RMB",
      subtitle: "This is approximately £16,000 or 21,000USD",
    },
  }
];

const Tiers = ({ classes }) => {
    return (
        <>
        {data.map(set => <Tier objectInformation={set} />)}
        </>
    )
}

export default withStyles((theme) => ({}))(Tiers);

The Child Component:

const Tier = ({ classes, objectInformation }) => {
  const {title, subtitle, list, bottom} = objectInformation 
  console.log("OBJECT INFORMATION", objectInformation)
  return (
    <div>{title}</div> 
  )
}

The end goal is to have multiple objects in the data variable, that'll pass down as props to Tiers, the parents component.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

You can't render an object within a component in React.

Either stringify your object

    const Tier = ({ classes, objectInformation }) => {
      return (
        <div>{JSON.stringify(objectInformation)}</div> 
      )
    }

or only select a part of it.

    const Tier = ({ classes, objectInformation }) => {
      return (
        <div>{objectInformation.title}</div> 
      )
    }
about 4 years ago · Juan Pablo Isaza Report

0

Solution

I missed an s on the imports.

Incorrect: import Tiers from "components/tiers/tier"

Correct: import Tiers from "components/tiers/tiers"

Changing this fixed the issue.

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!