<Show>
Edit this pageThe Show
control flow is used to conditionally render part of the view: it renders children when when
is truthy, a fallback otherwise. It is similar to the ternary operator (when ? children : fallback)
but is ideal for templating JSX.
Here's an example of using the Show
control flow:
Show
can also be used as a way of keying blocks to a specific data model. For example the function is re-executed whenever the user model is replaced.
If the keyed
property is not used, the argument of the child function will be an accessor containing the item.
Props
Name | Type | Description |
---|---|---|
when | T | undefined | null | false | The value to test for truthiness |
keyed | boolean | Whether to key the block to the value of when |
fallback | JSX.Element | The fallback to render when the when is falsy |