react-solid-flow
Version:
[SolidJS](https://www.solidjs.com/docs/latest/api#control-flow)-inspired basic control-flow components and everyday async state hook library for [React](https://reactjs.org/)
13 lines (12 loc) • 495 B
TypeScript
import { ReactElement, ReactNode } from "react";
interface ShowProps<T> {
/** predicate */
when: T | undefined | null | false;
/** content (or renderProp) to display when predicate is truthy */
children: ReactNode | ((item: NonNullable<T>) => ReactNode);
/** content to display when predicate is falsy */
fallback?: ReactNode;
}
/** Conditional rendering component */
export declare function Show<T>({ fallback, ...props }: ShowProps<T>): ReactElement | null;
export {};