Switch
Conditionally render blocks of content based on the when prop of nested
Match components.
import { Switch } from "@alloy-js/core";
<Switch > {children}</Switch>import { Switch } from "@alloy-js/core/stc";
Switch({ }).children(children)| children | Children |
Example
Section titled “Example”<Switch>
<Match when={someCondition}>
<div>Condition met!</div>
</Match>
<Match else>
<div>Condition not met!</div>
</Match>
</Switch>