SwitchCase()
function SwitchCase<Case>(props):
| null
| ReactElement<unknown, string | JSXElementConstructor<any>>
특정 값(value)에 따라 지정된 컴포넌트를 렌더링하는 컴포넌트입니다.
Type Parameters
| Type Parameter | Description |
|---|---|
Case extends Key | value로 사용될 수 있는 키 타입입니다. |
Parameters
| Parameter | Type |
|---|---|
props | SwitchCaseProps<Case> |
Returns
| null
| ReactElement<unknown, string | JSXElementConstructor<any>>
해당하는 컴포넌트 또는 default가 없으면 null을 반환합니다.
Example
<SwitchCase
value={status}
cases={{
a: <TypeA />,
b: <TypeB />,
c: <TypeC />,
}}
default={<Default />}
/>