like total
This commit is contained in:
1 parent
e28c70d440
commit
5707f5e2e3
2 files changed
+19
-11
No files matched your search
@@ -1,11 +1,20 @@
|
||||
import { useState } from "react";
|
||||
function Carte(props) {
|
||||
const [likes, setLikes] = useState(0);
|
||||
return (
|
||||
<div className="carte">
|
||||
<h2>{props.titre}</h2>
|
||||
<p>{props.niveaux}</p>
|
||||
<p>{props.createur}</p>
|
||||
<h2>{props.nom}</h2>
|
||||
<button onClick={props.onLike}>❤️ J'aime</button>
|
||||
<button
|
||||
onClick={() => {
|
||||
setLikes(likes + 1);
|
||||
props.onLike();
|
||||
}}
|
||||
>
|
||||
❤️ {likes}
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user