diff --git a/docs/CreateEdit.md b/docs/CreateEdit.md index 3ee5225df6..c0d1266bce 100644 --- a/docs/CreateEdit.md +++ b/docs/CreateEdit.md @@ -164,14 +164,18 @@ The `aside` component receives the same props as the `Edit` or `Create` child co const Aside = ({ record }) => (
Post details - - Creation date: {record.createdAt} - + {record && ( + + Creation date: {record.createdAt} + + )}
); ``` {% endraw %} +**Tip**: Always test that the `record` is defined before using it, as react-admin starts rendering the UI before the API call is over. + ## Prefilling a `` Record You may need to prepopulate a record based on another one. For that use case, use the `` component. It expects a `record` and a `basePath` (usually injected to children of ``, ``, ``, etc.), so it's as simple to use as a regular field or input. diff --git a/docs/Show.md b/docs/Show.md index c5833db697..b8fad975be 100644 --- a/docs/Show.md +++ b/docs/Show.md @@ -145,14 +145,18 @@ The `aside` component receives the same props as the `Show` child component: `ba const Aside = ({ record }) => (
Post details - - Creation date: {record.createdAt} - + {record && ( + + Creation date: {record.createdAt} + + )}
); ``` {% endraw %} +**Tip**: Always test that the `record` is defined before using it, as react-admin starts rendering the UI before the API call is over. + ## The `` component Instead of a custom `Show`, you can use the `ShowGuesser` to determine which fields to use based on the data returned by the API.