25 lines
448 B
React
25 lines
448 B
React
import { render } from 'preact'
|
|
import { useState } from 'preact/hooks'
|
|
|
|
const Counter = ({}) => {
|
|
const [value, setValue] = useState(0)
|
|
|
|
const increment = () => {
|
|
setValue(value => value + 1)
|
|
}
|
|
|
|
return (
|
|
<p>
|
|
Counter: {value} <button onClick={increment}>+</button>
|
|
</p>
|
|
)
|
|
}
|
|
|
|
render(
|
|
<>
|
|
<h1>Preact is Working!</h1>
|
|
<Counter />
|
|
</>,
|
|
document.querySelector('#app')
|
|
)
|