Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[P2C5-Solution] L'alerte au clic sur la li ne fonctionne pas #10

Open
PointonKaren opened this issue Aug 9, 2022 · 0 comments
Open

Comments

@PointonKaren
Copy link

Il y a une coquille dans le fichier PlantItem.js.

La fonction PlantItem dans la solution est :

function PlantItem({ cover, name, water, light }) {
  return (
    <li className="lmj-plant-item" onClick={() => handleClick}>
      <img className="lmj-plant-item-cover" src={cover} alt={`${name} cover`} />
      {name}
      <div>
        <CareScale careType="water" scaleValue={water} />
        <CareScale careType="light" scaleValue={light} />
      </div>
    </li>
  );
}

Pour que l'event onClick fonctionne, l'appel à la fonction handleClick devrait être ainsi handleClick(name).
Une fois corrigée, la fonction PlantItem ressemble à ceci :

function PlantItem({ cover, name, water, light }) {
  return (
    <li className="lmj-plant-item" onClick={() => handleClick(name)}>
      <img className="lmj-plant-item-cover" src={cover} alt={`${name} cover`} />
      {name}
      <div>
        <CareScale careType="water" scaleValue={water} />
        <CareScale careType="light" scaleValue={light} />
      </div>
    </li>
  );
}
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

No branches or pull requests

1 participant