{"record":{"id":"1e759f55a43a0f51","repo":"marmelab/react-admin","slug":"show-requires-either-a-render-prop-or-childre","errorCode":null,"errorMessage":"<Show> requires either a `render` prop or `children` prop","messagePattern":"<Show> requires either a `render` prop or `children` prop","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/ra-ui-materialui/src/detail/Show.tsx","lineNumber":82,"sourceCode":") => {\n    const props = useThemeProps({\n        props: inProps,\n        name: PREFIX,\n    });\n\n    const {\n        id,\n        resource,\n        queryOptions,\n        disableAuthentication,\n        authLoading = defaultAuthLoading,\n        loading,\n        error,\n        ...rest\n    } = props;\n\n    if (!props.render && !props.children) {\n        throw new Error(\n            '<Show> requires either a `render` prop or `children` prop'\n        );\n    }\n\n    return (\n        <ShowBase<RecordType>\n            id={id}\n            disableAuthentication={disableAuthentication}\n            queryOptions={queryOptions}\n            resource={resource}\n            authLoading={authLoading}\n            loading={loading}\n            // Disable redirect on error as it is handled by ShowView to display the error in the ShowView container\n            redirectOnError={error ? false : undefined}\n            // Disable offline support from ShowBase as it is handled by ShowView to keep the ShowView container\n            offline={false}\n        >\n            <ShowView error={error} {...rest} />","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/marmelab/react-admin/blob/051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0/packages/ra-ui-materialui/src/detail/Show.tsx#L64-L100","documentation":"React-admin's <Show> component is a layout wrapper; it does not render anything itself unless you tell it what to render via the `render` prop or `children`. When neither is provided, there is nothing to display, so it throws immediately at render time to fail fast instead of rendering an empty page.","triggerScenarios":"Rendering <Show> (or <ShowBase>-backed <Show>) without passing either a `children` prop (e.g. child fields) or a `render` prop (function returning UI). e.g. `<Show>{...}</Show>` with children accidentally removed, or `<Show resource=\"posts\" />` used as a bare route element.","commonSituations":"Refactoring from the old guesser-based <Show> (children optional via ShowGuesser) to the newer API where children/render is mandatory; copying a route definition where the JSX body was deleted; TypeScript not catching it because props were spread or cast as any.","solutions":["Pass children (fields/components) to <Show>, e.g. `<Show><SimpleShowConfiguration>...</SimpleShowConfiguration></Show>`.","Alternatively pass a `render` prop: `<Show render={record => <div>...</div>} />`.","If you want automatic inference, use `<ShowGuesser>` or <Show> with an inferred child instead of an empty <Show>."],"exampleFix":"// before\n<Show resource=\"posts\" />\n\n// after\n<Show resource=\"posts\">\n  <SimpleShowLayout>\n    <TextField source=\"title\" />\n  </SimpleShowLayout>\n</Show>","handlingStrategy":"validation","validationCode":"const canRenderShow = !!(props.children || props.render);\nif (!canRenderShow) throw new Error('<Show> needs children or render');","typeGuard":"const hasShowContent = (p: { children?: React.ReactNode; render?: (r: any) => React.ReactNode }): p is typeof p & { children: React.ReactNode } | typeof p & { render: (r: any) => React.ReactNode } => Boolean(p.children ?? p.render);","tryCatchPattern":null,"preventionTips":["Always give <Show> a SimpleShowLayout/TabbedShowLayout with fields as children.","Use render prop when the UI is record-dependent and custom.","Let TypeScript check the JSX rather than casting props to any."],"tags":["react-admin","show","missing-props","render-time-error"],"backgroundTag":"required-prop-missing","analyzedSha":"051f511bb0afb5ea565c2d3728bf4dab0a6fa5e0","analyzedAt":"2026-08-30T02:28:14.926Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}