You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Edit.md
+28Lines changed: 28 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -66,6 +66,7 @@ You can customize the `<Edit>` component using the following props:
66
66
*[`actions`](#actions): override the actions toolbar with a custom component
67
67
*[`aside`](#aside): component to render aside to the main content
68
68
*`children`: the components that renders the form
69
+
*`render`: a function to renders the form, receive the editContext as argument.
69
70
*`className`: passed to the root component
70
71
*[`component`](#component): override the root component
71
72
*[`disableAuthentication`](#disableauthentication): disable the authentication check
@@ -80,6 +81,33 @@ You can customize the `<Edit>` component using the following props:
80
81
*[`title`](#title): override the page title
81
82
*[`transform`](#transform): transform the form data before calling `dataProvider.update()`
82
83
84
+
## `render`
85
+
86
+
Alternatively to children you can pass a render prop to `<List>`. The render prop will receive the list context as its argument, allowing to inline the render logic for both the list content.
87
+
When receiving a render prop the `<List>` component will ignore the children property.
88
+
89
+
{% raw %}
90
+
```tsx
91
+
<List
92
+
render={({ error, isPending }) => {
93
+
if (isPending) {
94
+
return <div>Loading...</div>;
95
+
}
96
+
if (error) {
97
+
return <div>Error: {error.message}</div>;
98
+
}
99
+
return (
100
+
<SimpleList
101
+
primaryText="%{title} (%{year})"
102
+
secondaryText="%{summary}"
103
+
tertiaryText={record=>record.year}
104
+
/>
105
+
);
106
+
}}
107
+
/>
108
+
```
109
+
{% endraw %}
110
+
83
111
## `actions`
84
112
85
113
You can replace the list of default actions by your own elements using the `actions` prop:
0 commit comments