> Switch-case React component to render nested components.
> Switch-case React component to render nested components.
Install with npm:
``sh`
npm install --save react-switch-case-render
`ts
import { Switch, Case, Default } from 'react-switch-case-render';
function Example({ expression }) {
const type = 'show';
return (
);
}
`
#### \
The components provide an expression, matching the expression's value against a series of components, and render children after the first with a matching value.
| Prop | Type |
| ---------- | ------------------------------------ |
| expression | string/number/boolean/null/undefined |
| children | React.ReactNode |
#### \
provide an value used to match against expression. if the expression matches the value, the children will be render.
| Prop | Type |
| -------- | ------------------------------------ |
| value | string/number/boolean/null/undefined |
| children | React.ReactNode |
#### \
if the value of expression doesn't match any of the value, the children` will be render.
| Prop | Type |
| -------- | --------------- |
| children | React.ReactNode |