The Show component is a simple way to conditionally render content in your UI. It is inspired by SolidJS and provides a clean and declarative way to handle conditional rendering.
import { Show } from '@cerberus/react'
Usage
The Show component takes a when
prop that determines whether the children or the fallback
content should be rendered. If when
is true, the children are rendered. If when
is false, the fallback
content is rendered.
You are not allowed to enter!
API
export interface ShowProps { when: boolean | null | undefined fallback?: ReactNode}
define function Show(props: ShowProps): ReactNode | null
Props
The Show
component accepts the following props:
Name | Default | Description |
---|---|---|
when | false | The condition to evalue for showing the children or fallback. |
fallback | null | The content to render when the condition is false. |