aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/docs/components/counters.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'docs/components/counters.tsx')
-rw-r--r--docs/components/counters.tsx24
1 files changed, 24 insertions, 0 deletions
diff --git a/docs/components/counters.tsx b/docs/components/counters.tsx
new file mode 100644
index 0000000..b78f12d
--- /dev/null
+++ b/docs/components/counters.tsx
@@ -0,0 +1,24 @@
+// Example from https://beta.reactjs.org/learn
+
+import { useState } from 'react'
+import styles from './counters.module.css'
+
+function MyButton() {
+ const [count, setCount] = useState(0)
+
+ function handleClick() {
+ setCount(count + 1)
+ }
+
+ return (
+ <div>
+ <button onClick={handleClick} className={styles.counter}>
+ Clicked {count} times
+ </button>
+ </div>
+ )
+}
+
+export default function MyApp() {
+ return <MyButton />
+}