Skip to content

Commit 15223cf

Browse files
committed
reorder props sections in ShowBase documentation
1 parent cc2ec92 commit 15223cf

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

docs/ShowBase.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -108,33 +108,6 @@ const BookShow = () => (
108108
```
109109
{% endraw %}
110110

111-
## `render`
112-
113-
Alternatively, you can pass a `render` function prop instead of children. This function will receive the `ShowContext` as argument.
114-
115-
{% raw %}
116-
```jsx
117-
import { ShowBase, TextField, DateField, ReferenceField, WithRecord } from 'react-admin';
118-
119-
const BookShow = () => (
120-
<ShowBase render={({ isPending, error, record }) => {
121-
if (isPending) {
122-
return <p>Loading...</p>;
123-
}
124-
125-
if (error) {
126-
return (
127-
<p className="error">
128-
{error.message}
129-
</p>
130-
);
131-
}
132-
return <p>{record.title}</p>;
133-
}}/>
134-
);
135-
```
136-
{% endraw %}
137-
138111
## `disableAuthentication`
139112

140113
By default, the `<ShowBase>` component will automatically redirect the user to the login page if the user is not authenticated. If you want to disable this behavior and allow anonymous access to a show page, set the `disableAuthentication` prop to `true`.
@@ -253,6 +226,33 @@ The default `onError` function is:
253226
}
254227
```
255228

229+
## `render`
230+
231+
Alternatively, you can pass a `render` function prop instead of children. This function will receive the `ShowContext` as argument.
232+
233+
{% raw %}
234+
```jsx
235+
import { ShowBase, TextField, DateField, ReferenceField, WithRecord } from 'react-admin';
236+
237+
const BookShow = () => (
238+
<ShowBase render={({ isPending, error, record }) => {
239+
if (isPending) {
240+
return <p>Loading...</p>;
241+
}
242+
243+
if (error) {
244+
return (
245+
<p className="error">
246+
{error.message}
247+
</p>
248+
);
249+
}
250+
return <p>{record.title}</p>;
251+
}}/>
252+
);
253+
```
254+
{% endraw %}
255+
256256
## `resource`
257257

258258
By default, `<ShowBase>` operates on the current `ResourceContext` (defined at the routing level), so under the `/posts/1/show` path, the `resource` prop will be `posts`. You may want to force a different resource. In this case, pass a custom `resource` prop, and it will override the `ResourceContext` value.

0 commit comments

Comments
 (0)