deno.land / x / fresh@1.1.1 / examples / counter / islands / Counter.tsx
12345678910111213141516171819202122import { useState } from "preact/hooks";import { IS_BROWSER } 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> );}
Version Info