Switch & Match

Switch renders the first matching Match child in order. Each Match is evaluated with the same truthiness rules as Show, and fallback is rendered when nothing matches.

Basic usage#

Place multiple Match components inside Switch and provide an optional fallback.

Function children#

If you pass a function to Match, it receives the evaluated value for that branch.

DOM-preserving variants#

Use Switch.div to keep a wrapper element while swapping the matched content.

Components - Control Flow Utilities | ilokesto - React Library Collection