UNPKG

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/)

16 lines (15 loc) 718 B
import type { ReactElement, ReactNode } from "react"; interface ForProps<T, U extends ReactNode> { /** Array to iterate over */ each: ReadonlyArray<T> | undefined | null; /** RenderProp for children generation * OR a static element displayed each.length times */ children: ReactNode | ((item: T, idx: number) => U); /** Fallback item, displayed if *each* has zero length, or isn't an array */ fallback?: ReactNode; } /** Component for mapping an array into collection of ReactNode's * Omits nullish children and provides keys if they're not specified. */ export declare function For<T, U extends ReactNode>({ children, each, fallback, }: ForProps<T, U>): ReactElement | null; export {};