This commit updates fresh to use import maps instead of deps files in generated projects.
22 lines
489 B
TypeScript
22 lines
489 B
TypeScript
/** @jsx h */
|
|
import { h, IS_BROWSER, useState } from "$fresh/runtime.ts";
|
|
|
|
interface CounterProps {
|
|
start: number;
|
|
}
|
|
|
|
export default function Counter(props: CounterProps) {
|
|
const [count, setCount] = useState(props.start);
|
|
return (
|
|
<div>
|
|
<p>{count}</p>
|
|
<button onClick={() => setCount(count - 1)} disabled={!IS_BROWSER}>
|
|
-1
|
|
</button>
|
|
<button onClick={() => setCount(count + 1)} disabled={!IS_BROWSER}>
|
|
+1
|
|
</button>
|
|
</div>
|
|
);
|
|
}
|