fix: reviving multiple islands on one page (#197)
Co-authored-by: Luca Casonato <hello@lcas.dev>
This commit is contained in:
co-authored by
Luca Casonato
parent
458fe2ca3c
commit
afafb7c938
@@ -0,0 +1,23 @@
|
||||
/** @jsx h */
|
||||
import { h, IS_BROWSER, useState } from "$fresh/runtime.ts";
|
||||
|
||||
interface CounterProps {
|
||||
start: number;
|
||||
id: string;
|
||||
}
|
||||
|
||||
export default function Counter(props: CounterProps) {
|
||||
const [count, setCount] = useState(props.start);
|
||||
return (
|
||||
<div id={props.id}>
|
||||
<p>{count}</p>
|
||||
<button
|
||||
id={`b-${props.id}`}
|
||||
onClick={() => setCount(count + 1)}
|
||||
disabled={!IS_BROWSER}
|
||||
>
|
||||
+1
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user