f591150512
* basics, framework-alpine, framework-solid, delete unused examples * framework-multiple * Remove non-standard file extensions, add missing .vscode folders * Remove robots.txt * Remove blog-multiple-authors * Rewrite components comments to be consistent * Update lockfile * Remove unnecessary usage of SCSS in subpath example * Fix props weirdness in portfolio example * Remove Lit from `framework-multiple` for now * Misc fixes * Update lockfile * I'm in lockfile hell, send help
21 lines
502 B
TypeScript
21 lines
502 B
TypeScript
/** @jsxImportSource preact */
|
|
|
|
import { useState } from 'preact/hooks';
|
|
|
|
/** A counter written with Preact */
|
|
export function PreactCounter({ children }) {
|
|
const [count, setCount] = useState(0);
|
|
const add = () => setCount((i) => i + 1);
|
|
const subtract = () => setCount((i) => i - 1);
|
|
|
|
return (
|
|
<>
|
|
<div class="counter">
|
|
<button onClick={subtract}>-</button>
|
|
<pre>{count}</pre>
|
|
<button onClick={add}>+</button>
|
|
</div>
|
|
<div class="counter-message">{children}</div>
|
|
</>
|
|
);
|
|
}
|