forked from phc/website
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
380 B
JavaScript
14 lines
380 B
JavaScript
import { useState } from 'preact/hooks'
|
|
|
|
export const Counter = ({}) => {
|
|
const [count, setCount] = useState(0)
|
|
|
|
return (
|
|
<div class="counter">
|
|
<button onClick={() => setCount(value => value - 1)}>-</button>
|
|
<div class="value">{count}</div>
|
|
<button onClick={() => setCount(value => value + 1)}>+</button>
|
|
</div>
|
|
)
|
|
}
|