{"record":{"id":"b2e2a5ccfbe80f0d","repo":"marmelab/react-admin","slug":"edit-requires-either-a-render-prop-or-childre","errorCode":null,"errorMessage":"<Edit> requires either a `render` prop or `children` prop","messagePattern":"<Edit> requires either a `render` prop or `children` prop","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/ra-ui-materialui/src/detail/Edit.tsx","lineNumber":80,"sourceCode":"\n    const {\n        resource,\n        id,\n        mutationMode,\n        mutationOptions,\n        queryOptions,\n        redirect,\n        transform,\n        disableAuthentication,\n        authLoading = defaultAuthLoading,\n        loading,\n        error,\n        redirectOnError,\n        ...rest\n    } = props;\n\n    if (!props.render && !props.children) {\n        throw new Error(\n            '<Edit> requires either a `render` prop or `children` prop'\n        );\n    }\n\n    return (\n        <EditBase<RecordType>\n            resource={resource}\n            id={id}\n            mutationMode={mutationMode}\n            mutationOptions={mutationOptions}\n            queryOptions={queryOptions}\n            redirect={redirect}\n            transform={transform}\n            disableAuthentication={disableAuthentication}\n            authLoading={authLoading}\n            loading={loading}\n            // Disable redirect on error as it is handled by EditView to display the error in the EditView container\n            redirectOnError={redirectOnError ?? (error ? false : undefined)}","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/marmelab/react-admin/blob/051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0/packages/ra-ui-materialui/src/detail/Edit.tsx#L62-L98","documentation":"The <Edit> view must receive content to render: either a `render` function prop or `children`. If both are missing the library throws immediately, since rendering nothing would leave a blank edit page.","triggerScenarios":"Rendering <Edit resource=\"posts\"> with neither children nor render; children conditionally resolving to undefined/null at runtime.","commonSituations":"Migration/refactor dropping the form child; copying boilerplate without the form; dynamic children logic that returns undefined.","solutions":["Pass children: <Edit resource=\"posts\"><SimpleForm>...</SimpleForm></Edit>","Or pass render: <Edit resource=\"posts\" render={() => <SimpleForm>...</SimpleForm>} />","Verify conditional wrappers don't swallow the children"],"exampleFix":"// before\n<Edit resource=\"posts\" />\n// after\n<Edit resource=\"posts\">\n  <SimpleForm><TextInput source=\"title\" /></SimpleForm>\n</Edit>","handlingStrategy":"validation","validationCode":"if (React.Children.count(props.children) === 0 && !props.render) {\n  throw new Error('<Edit> requires children or a render prop');\n}","typeGuard":"const editHasBody = (p: { children?: React.ReactNode; render?: () => React.ReactNode }): boolean =>\n  typeof p.render === 'function' || React.Children.count(p.children) > 0;","tryCatchPattern":null,"preventionTips":["Pair every <Edit> with a form component child immediately","Watch for ternaries that can yield undefined children","Keep view definitions colocated with their forms"],"tags":["react-admin","missing-prop","edit-view"],"backgroundTag":"missing-required-prop","analyzedSha":"051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0","analyzedAt":"2026-08-30T02:28:14.926Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}