{"record":{"id":"3dd4c3d9ad805d7d","repo":"marmelab/react-admin","slug":"createbase-requires-either-a-render-prop-or-c","errorCode":null,"errorMessage":"<CreateBase> requires either a `render` prop or `children` prop","messagePattern":"<CreateBase> requires either a `render` prop or `children` prop","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/ra-core/src/controller/create/CreateBase.tsx","lineNumber":65,"sourceCode":"    children,\n    render,\n    loading,\n    authLoading = loading,\n    ...props\n}: CreateBaseProps<RecordType, ResultRecordType, MutationOptionsError>) => {\n    const controllerProps = useCreateController<\n        RecordType,\n        MutationOptionsError,\n        ResultRecordType\n    >(props);\n\n    const isAuthPending = useIsAuthPending({\n        resource: controllerProps.resource,\n        action: 'create',\n    });\n\n    if (!render && !children) {\n        throw new Error(\n            '<CreateBase> requires either a `render` prop or `children` prop'\n        );\n    }\n\n    const showAuthLoading =\n        isAuthPending &&\n        !props.disableAuthentication &&\n        authLoading !== false &&\n        authLoading !== undefined;\n\n    return (\n        // We pass props.resource here as we don't need to create a new ResourceContext if the props is not provided\n        <OptionalResourceContextProvider value={props.resource}>\n            <CreateContextProvider value={controllerProps}>\n                {showAuthLoading\n                    ? authLoading\n                    : render\n                      ? render(controllerProps)","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/marmelab/react-admin/blob/051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0/packages/ra-core/src/controller/create/CreateBase.tsx#L47-L83","documentation":"CreateBase is a headless controller component: it manages create state but renders nothing itself, so callers must tell it what to render via a render prop or children. If neither is provided, there is nothing to render and react-admin throws at render time.","triggerScenarios":"Rendering <CreateBase resource=\"posts\"> with no children and no render prop; wrapping CreateBase in a custom component that forgot to forward children; conditional rendering that yields undefined children.","commonSituations":"Migrating from older versions that rendered children implicitly; building custom create pages and forgetting the render prop; passing children conditionally (e.g. {someCondition && <MyCreate/>}) resulting in none at runtime.","solutions":["Pass children: <CreateBase resource=\"posts\"><MyCreateForm/></CreateBase>","Or pass a render prop: <CreateBase resource=\"posts\" render={() => <MyCreateForm/>} />","If wrapping CreateBase, forward children/render props through your custom component"],"exampleFix":"// before\n<CreateBase resource=\"posts\" redirect=\"list\" /> // nothing to render\n// after\n<CreateBase resource=\"posts\" redirect=\"list\">\n    <SimpleForm>\n        <TextInput source=\"title\" />\n    </SimpleForm>\n</CreateBase>","handlingStrategy":"validation","validationCode":"const RenderCreateBase = props =>\n    !props.render && !props.children\n        ? null // or throw/warn in dev\n        : <CreateBase {...props} />;","typeGuard":"const hasRenderable = (p: { render?: unknown; children?: unknown }): boolean =>\n    typeof p.render === 'function' || p.children != null;","tryCatchPattern":"try {\n    return <CreateBase resource=\"posts\">{children}</CreateBase>;\n} catch (e) {\n    if (e instanceof Error && e.message.includes('render` prop or `children')) {\n        console.error('CreateBase rendered without render prop or children');\n        return null;\n    }\n    throw e;\n}","preventionTips":["Always pass children or a render prop to headless *Base components","Forward children through custom wrapper components","Check that conditional children cannot evaluate to undefined at runtime","Keep TypeScript props typed with children?: ReactNode | render?: () => ReactNode"],"tags":["react","create","props","configuration"],"backgroundTag":"missing-render-prop","analyzedSha":"051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0","analyzedAt":"2026-08-30T02:28:14.926Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}