trying to understand how to add a like total that works
This commit is contained in:
@@ -31,7 +31,8 @@ const jeux = [
|
||||
|
||||
function App() {
|
||||
const [recherche, setRecherche] = useState("");
|
||||
|
||||
const [total, setTotal] = useState(0);
|
||||
|
||||
const filtres = jeux.filter((j) =>
|
||||
j.titre.toLowerCase().includes(recherche.toLowerCase()),
|
||||
);
|
||||
@@ -55,9 +56,12 @@ function App() {
|
||||
titre={jeu.titre}
|
||||
console={jeu.console}
|
||||
annee={jeu.annee}
|
||||
onLike={() => setTotal((t) => t + 1)}
|
||||
/>
|
||||
))}
|
||||
|
||||
<p> Total de likes : {total}</p>
|
||||
|
||||
<section id="spacer"></section>
|
||||
<Footer />
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user