UNPKG

reactrators

Version:

A React library for composing and enhancing components with flexible and chainable functions. Simplify the process of injecting functionality and props into React components by providing a composable utility for building component enhancers.

17 lines (13 loc) 665 B
import * as react from 'react'; import { ComponentType } from 'react'; type InjectableParams = Record<string, any>; type InjectableFunction = (params?: InjectableParams) => InjectableParams; type InjectableEntry = [InjectableFunction, InjectableParams]; type EnhancedProps = { [key: string]: any; }; type ComposableOptions = { chainable?: boolean; }; declare const composable: (fn: (props?: Record<any, any>) => (InjectableFunction | InjectableEntry)[], opts: ComposableOptions) => <P extends EnhancedProps>(Component: ComponentType<P>) => (props: P) => react.ReactElement<P, string | react.JSXElementConstructor<any>>; export { composable as default };