import { ReactNode } from 'react'; import { useEditController, EditControllerProps, EditControllerResult, } from './useEditController'; import { RaRecord } from '../../types'; /** * Render prop version of the useEditController hook * * @see useEditController * @example * * const EditView = () =>
...
* const MyEdit = props => ( * * {controllerProps => } * * ); */ export const EditController = < RecordType extends RaRecord = any, ErrorType = Error, >({ children, ...props }: { children: ( params: EditControllerResult ) => ReactNode; } & EditControllerProps) => { const controllerProps = useEditController(props); return children(controllerProps); };