Skip to content

Conversation

@NoamElisha
Copy link

No description provided.

Copy link
Member

@Tamir198 Tamir198 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left you some changes, if you want write me in here and I will give you another challenge for this pr


const Country = () => {
export const Country = ({ name, flag, population, region, capital }) => {
return (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good practice on using destructor here

<div className="countries-grid">
{countries.map((country) => (
<Country
key={country.name}
Copy link
Member

@Tamir198 Tamir198 Dec 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add another props to you Card component like this :

export const Country = ({ name, flag, population, region, capital, ...props }) => { 
  return (
    <div {...props}>
      <img src={flag} alt={`${name} flag`} width="100" />
      <h2>{name}</h2>
      <p>Population: {population.toLocaleString()}</p>
      <p>Region: {region}</p>
      <p>Capital: {capital}</p>
    </div>
  );
};

Then all you need to do it call you component like this:

<Country
     //Your props goes in here
      {...country}}
>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants