summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/components/Counter.jsx13
-rw-r--r--src/pages/index.astro3
2 files changed, 15 insertions, 1 deletions
diff --git a/src/components/Counter.jsx b/src/components/Counter.jsx
new file mode 100644
index 0000000..a2ae7c3
--- /dev/null
+++ b/src/components/Counter.jsx
@@ -0,0 +1,13 @@
+import { useState } from 'react';
+
+export default function Counter() {
+ const [count, setCount] = useState(0);
+
+ return (
+ <div className="counter">
+ <button onClick={() => setCount(count + 1)}>
+ Clicked {count} times
+ </button>
+ </div>
+ );
+}
diff --git a/src/pages/index.astro b/src/pages/index.astro
index 2d14107..ce6dc4e 100644
--- a/src/pages/index.astro
+++ b/src/pages/index.astro
@@ -1,5 +1,5 @@
---
-
+import Counter from '../components/Counter';
---
<html lang="en">
@@ -12,5 +12,6 @@
</head>
<body>
<h1>Astro</h1>
+ <Counter client:load />
</body>
</html>