{"record":{"id":"b46dc608f27cdcc8","repo":"marmelab/react-admin","slug":"editbase-requires-either-a-render-prop-or-chi","errorCode":null,"errorMessage":"<EditBase> requires either a 'render' prop or 'children' prop","messagePattern":"<EditBase> requires either a 'render' prop or 'children' prop","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/ra-core/src/controller/edit/EditBase.tsx","lineNumber":65,"sourceCode":"    error,\n    redirectOnError,\n    children,\n    render,\n    ...props\n}: EditBaseProps<RecordType, ErrorType>) => {\n    const hasError = error !== false && error !== undefined;\n    const controllerProps = useEditController<RecordType, ErrorType>({\n        ...props,\n        redirectOnError: redirectOnError ?? (hasError ? false : undefined),\n    });\n\n    const isAuthPending = useIsAuthPending({\n        resource: controllerProps.resource,\n        action: 'edit',\n    });\n\n    if (!render && !children) {\n        throw new Error(\n            \"<EditBase> requires either a 'render' prop or 'children' prop\"\n        );\n    }\n\n    const { isPaused, isPending, error: errorState } = controllerProps;\n\n    const showAuthLoading =\n        isAuthPending &&\n        !props.disableAuthentication &&\n        authLoading !== false &&\n        authLoading !== undefined;\n\n    const showLoading =\n        !isPaused &&\n        ((!props.disableAuthentication && isAuthPending) || isPending) &&\n        loading !== false &&\n        loading !== undefined;\n","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/marmelab/react-admin/blob/051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0/packages/ra-core/src/controller/edit/EditBase.tsx#L47-L83","documentation":"EditBase is the headless controller for edit pages; it manages fetching and updating the record but renders nothing itself. It requires a render prop or children to know what UI to display; when neither is given it throws, mirroring the CreateBase contract.","triggerScenarios":"Rendering <EditBase resource=\"posts\" id={id}> without children or render prop; a custom edit wrapper that forgets to pass children through; conditional children that resolve to nothing at runtime.","commonSituations":"Building custom edit pages from headless components and omitting the render output; migrating from older react-admin versions with different render contracts; spreading props conditionally so children end up undefined.","solutions":["Pass children: <EditBase resource=\"posts\" id={id}><SimpleForm>...</SimpleForm></EditBase>","Or pass a render prop: <EditBase ... render={() => <MyEditForm/>} />","Forward children/render in any custom wrapper component around EditBase"],"exampleFix":"// before\n<EditBase resource=\"posts\" id={postId} redirect=\"list\" /> // nothing to render\n// after\n<EditBase resource=\"posts\" id={postId} redirect=\"list\">\n    <SimpleForm>\n        <TextInput source=\"title\" />\n    </SimpleForm>\n</EditBase>","handlingStrategy":"validation","validationCode":"const RenderEditBase = props =>\n    !props.render && !props.children\n        ? null // or warn in dev\n        : <EditBase {...props} />;","typeGuard":"const hasRenderable = (p: { render?: unknown; children?: unknown }): boolean =>\n    typeof p.render === 'function' || p.children != null;","tryCatchPattern":"try {\n    return <EditBase resource=\"posts\" id={id}>{children}</EditBase>;\n} catch (e) {\n    if (e instanceof Error && e.message.includes(\"render' prop or 'children\")) {\n        console.error('EditBase rendered without render prop or children');\n        return null;\n    }\n    throw e;\n}","preventionTips":["Always provide children or a render prop to EditBase","Forward children/render props through custom edit page wrappers","Ensure conditional children are non-empty when EditBase renders","Type wrapper props with children?: ReactNode or render?: () => ReactNode to catch omissions"],"tags":["react","edit","props","configuration"],"backgroundTag":"missing-render-prop","analyzedSha":"051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0","analyzedAt":"2026-08-30T02:28:14.926Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}