fix(server): sanitize brackets from island names (#1723)

This commit is contained in:
Reed von Redwitz
2023-09-01 15:58:15 +02:00
committed by GitHub
parent 03df5f7306
commit 4a4af1f915
5 changed files with 121 additions and 46 deletions
@@ -0,0 +1,22 @@
import type { Signal } from "@preact/signals";
import { IS_BROWSER } from "$fresh/runtime.ts";
interface CounterProps {
count: Signal<number>;
id: string;
}
export default function Counter(props: CounterProps) {
return (
<div id={props.id}>
<p>{props.count}</p>
<button
id={`b-${props.id}`}
onClick={() => props.count.value += 1}
disabled={!IS_BROWSER}
>
+1
</button>
</div>
);
}
@@ -0,0 +1,10 @@
import { useSignal } from "@preact/signals";
import Counter from "./(_islands)/Counter.tsx";
export default function Home() {
return (
<div>
<Counter id="counter" count={useSignal(3)} />
</div>
);
}