From 5707f5e2e31079a3f9dca0d74af8179766432bc8 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Wed, 24 Jun 2026 15:30:30 +0200 Subject: [PATCH] like total --- mon-projet/src/App.jsx | 19 +++++++++---------- mon-projet/src/components/carte.jsx | 11 ++++++++++- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/mon-projet/src/App.jsx b/mon-projet/src/App.jsx index 564ba7b..eac4bac 100644 --- a/mon-projet/src/App.jsx +++ b/mon-projet/src/App.jsx @@ -32,21 +32,15 @@ const trilogies = [ ]; function App() { + const [likes, setLikes] = useState(0); const [recherche, setRecherche] = useState(""); const [total, setTotal] = useState(0); const filtrees = trilogies.filter((t) => t.nom.toLowerCase().includes(recherche.toLowerCase()), ); + return (
-

👍 Total de likes : {total}

- {trilogies.map((trilo) => ( - setTotal((t) => t + 1)} // 👈 on passe une FONCTION en prop - /> - ))}
{filtrees.length === 0 &&

Aucune trilogie trouvée

} - +

👍 Total de likes : {total}

{filtrees.map((trilo) => ( - + setTotal((t) => t + 1)} + /> ))}
diff --git a/mon-projet/src/components/carte.jsx b/mon-projet/src/components/carte.jsx index 8d26953..dcbc6e3 100644 --- a/mon-projet/src/components/carte.jsx +++ b/mon-projet/src/components/carte.jsx @@ -1,11 +1,20 @@ +import { useState } from "react"; function Carte(props) { + const [likes, setLikes] = useState(0); return (

{props.titre}

{props.niveaux}

{props.createur}

{props.nom}

- +
); }