react-to-component
Version:
Blazing fast library to componentify imperative or functional apis
13 lines (12 loc) • 379 B
TypeScript
/// <reference types="react" />
export interface Result<T> {
data: T | null;
error: Error | null;
loading: boolean;
}
export interface Props<T, P> {
original: (...params: P[]) => Promise<T> | T;
params: P[];
children: (result: Result<T>) => JSX.Element | JSX.Element[] | null;
parametersDidChange: (previousParams: P[], nextParams: P[]) => boolean;
}