Aggiunta pagina per appunti condivisi con setup minimale di Preact
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
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')
|
||||
)
|
||||
Reference in New Issue
Block a user