From 160d199ff66c26fde22858e160c94bee2cfef9e5 Mon Sep 17 00:00:00 2001 From: Jakub Knetl Date: Thu, 21 Dec 2023 14:57:40 +0100 Subject: [PATCH] Chapter 7 - add state --- index.html | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/index.html b/index.html index 2452480..a770376 100644 --- a/index.html +++ b/index.html @@ -15,6 +15,12 @@ function HomePage() { const names = ['Ada Lovelace', 'Grace Hopper', 'Margaret Hamilton']; + const [likes, setLikes] = React.useState(0); + + function handleClick() { + setLikes(likes + 1); + } + return (
@@ -23,6 +29,7 @@
  • {name}
  • ))} +
    ) }