import { ReactNode } from 'react'; import { RaRecord } from '../../types'; import { useShowController, ShowControllerProps, ShowControllerResult, } from './useShowController'; /** * Render prop version of the useShowController hook * * @see useShowController * @example * * const ShowView = () =>
...
* const MyShow = () => ( * * {controllerProps => } * * ); */ export const ShowController = < RecordType extends RaRecord = any, ErrorType = Error, >({ children, ...props }: { children: ( params: ShowControllerResult ) => ReactNode; } & ShowControllerProps) => { const controllerProps = useShowController(props); return children(controllerProps); };