import {FC} from 'react'; import render from './render'; export type MapPropsToArgs = (props: Props) => Args; export type CreateRenderProp = (hook: (...args: Args) => State, mapPropsToArgs?: MapPropsToArgs) => FC; const defaultMapPropsToArgs = props => [props]; const hookToRenderProp: CreateRenderProp = (hook, mapPropsToArgs = defaultMapPropsToArgs as any) => props => render(props, hook(...mapPropsToArgs(props))); export default hookToRenderProp;