Skip to main content

Switch

Overview​

  • This component is the wrapper for the matching cases.
  • The only required prop is its children.
  • Valid children are: With, When, and Otherwise.
  • If you plan on having With cases, then you need to pass a value prop.
  • You are required to have at least one Otherwise component as children.
  • Just like Match, but it will return only the first match.

Examples​