blob: 3973e0125aa72cfe06fde4af6ee8e17faacc34cb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import { useState } from "react";
export function Counter() {
console.log('counter a');
const [count, setCount] = useState(0);
function increment() {
setCount(count + 1);
}
function decrement() {
setCount(count - 1);
}
return (
<div id="counter-fixture" className="rounded-bl-full">
<p>Count A: {count}</p>
<button className="inc" onClick={increment}>
+
</button>
<button className="dec" onClick={decrement}>
-
</button>
</div>
);
}
|