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

111
Views
Destructing an object and using it - React prop

I have a React component that receives a prop, 2 values should be destructed from the prop and the prop itself should be passed further, I tried the following but am receiving a Line 23:3: Duplicate key 'countryData' no-dupe-keys warning.

const IndividualCountryContainer = ({
  countryData: {
    name: { common },
    flags: { png },
  },
  countryData
}) => (
  <div className='country'>
    <img className='country-flag' src={png} alt={`${common}'s flag`} />
    <IndividualCountryData countryData={countryData} />
  </div>
);

So, how do I solve this?

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

0

Destructure your prop inside your function definition, like:

const IndividualCountryContainer = ({ countryData }) => {
  const {
    name: { common },
    flags: { png },
  } = countryData;

  return (
    <div className="country">
      <img className="country-flag" src={png} alt={`${common}'s flag`} />
      <IndividualCountryData countryData={countryData} />
    </div>
  );
};

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!