{"record":{"id":"5bc6faaec8ab655c","repo":"marmelab/react-admin","slug":"create-requires-either-a-render-prop-or-child","errorCode":null,"errorMessage":"<Create> requires either a `render` prop or `children` prop","messagePattern":"<Create> requires either a `render` prop or `children` prop","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/ra-ui-materialui/src/detail/Create.tsx","lineNumber":80,"sourceCode":"    });\n\n    const {\n        resource,\n        record,\n        redirect,\n        transform,\n        mutationMode,\n        mutationOptions,\n        disableAuthentication,\n        hasEdit,\n        hasShow,\n        loading,\n        authLoading = loading ?? defaultAuthLoading,\n        ...rest\n    } = props;\n\n    if (!props.render && !props.children) {\n        throw new Error(\n            '<Create> requires either a `render` prop or `children` prop'\n        );\n    }\n\n    return (\n        <CreateBase<RecordType, ResultRecordType>\n            resource={resource}\n            record={record}\n            redirect={redirect}\n            transform={transform}\n            mutationMode={mutationMode}\n            mutationOptions={mutationOptions}\n            disableAuthentication={disableAuthentication}\n            hasEdit={hasEdit}\n            hasShow={hasShow}\n            authLoading={authLoading}\n        >\n            <CreateView {...rest} />","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/marmelab/react-admin/blob/051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0/packages/ra-ui-materialui/src/detail/Create.tsx#L62-L98","documentation":"The <Create> view must know what to render. It requires either a `render` function prop or `children` elements; receiving neither is a programming mistake, so the library throws immediately at render. This enforces the newer declarative render API over empty usage.","triggerScenarios":"Rendering <Create resource=\"posts\"> with no children and no render prop; passing children conditionally such that both end up undefined (e.g. children={maybeUndefined}).","commonSituations":"Upgrading react-admin and replacing old `<Create><CreateForm/></Create>` incorrectly; copying a skeleton snippet; conditional rendering logic that drops all children.","solutions":["Pass children: <Create resource=\"posts\"><SimpleForm>...</SimpleForm></Create>","Or pass a render function: <Create resource=\"posts\" render={() => <SimpleForm>...</SimpleForm>} />","Check conditional logic so children/render is never undefined"],"exampleFix":"// before\n<Create resource=\"posts\" />\n// after\n<Create resource=\"posts\">\n  <SimpleForm><TextInput source=\"title\" /></SimpleForm>\n</Create>","handlingStrategy":"validation","validationCode":"if (!props.children && !props.render) {\n  throw new Error('<Create> requires a render prop or children');\n}\nReactDOM.createRoot(el).render(<Create resource=\"posts\"><SimpleForm>...</SimpleForm></Create>);","typeGuard":"const hasContent = (p: { children?: React.ReactNode; render?: () => React.ReactNode }): boolean =>\n  p.render != null || React.Children.count(p.children) > 0;","tryCatchPattern":null,"preventionTips":["Always provide SimpleForm/ListGuesser children in Create views","Avoid conditionally undefined children expressions","Add smoke tests that mount every resource view"],"tags":["react-admin","missing-prop","create-view"],"backgroundTag":"missing-required-prop","analyzedSha":"051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0","analyzedAt":"2026-08-30T02:28:14.926Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}