feat: support conditional island JSX children (#1355)
Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
This commit is contained in:
co-authored by
Asher Gomez
parent
dff80d3a42
commit
11077227b5
@@ -0,0 +1,16 @@
|
||||
import IslandConditional from "../islands/IslandConditional.tsx";
|
||||
import BooleanButton from "../islands/BooleanButton.tsx";
|
||||
import { signal } from "@preact/signals";
|
||||
|
||||
const show = signal(true);
|
||||
|
||||
export default function Page() {
|
||||
return (
|
||||
<div id="page">
|
||||
<IslandConditional show={show}>
|
||||
<p>server rendered</p>
|
||||
</IslandConditional>
|
||||
<BooleanButton signal={show} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import IslandConditional from "../islands/IslandConditional.tsx";
|
||||
import BooleanButton from "../islands/BooleanButton.tsx";
|
||||
import { useSignal } from "@preact/signals";
|
||||
import Counter from "../islands/Counter.tsx";
|
||||
|
||||
export default function Page() {
|
||||
const show = useSignal(true);
|
||||
const count = useSignal(0);
|
||||
|
||||
return (
|
||||
<div id="page">
|
||||
<IslandConditional show={show}>
|
||||
<div>
|
||||
<p class="server">server rendered</p>
|
||||
<Counter count={count} />
|
||||
</div>
|
||||
</IslandConditional>
|
||||
<BooleanButton signal={show} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user