UNPKG

components-switch

Version:

A lightweight React utility component library featuring Switch and Match for conditional rendering, inspired by SolidJS. Simplifies readable and declarative conditional logic in JSX.

9 lines (8 loc) 620 B
import { ReactNode } from "react"; import { Match } from "./Match"; import { OneOrMore } from "./types"; export type SwitchProps = { children: OneOrMore<typeof Match>; fallback?: ReactNode; }; export declare function Switch({ children, fallback }: SwitchProps): string | number | bigint | boolean | any[] | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode>>;