Skip to content

Commit 85ed6e9

Browse files
committed
improve and fix the tutorial
1 parent c0745dd commit 85ed6e9

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

docs/Tutorial.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ In react-admin, most configuration is done through components. Instead of using
358358

359359
So far, you've used [`<DataTable.Col>`](./DataTable.md#datatablecol) directly and [`EmailField`](./EmailField.md) as [a `<DataTable.Col>` child](./DataTable.md#children-1).
360360
React-admin provides [many more Field components](./Fields.md) to handle different data types—numbers, dates, images, arrays, and more.
361+
You can directly specify a field in your `DataTable.Col` using [the `field` prop](./DataTable.md#field), which is useful when no custom props are needed for that field.
361362

362363
For instance, instead of displaying the `website` field as plain text, you could make it a clickable link using [`<UrlField>`](./UrlField.md):
363364

@@ -374,9 +375,7 @@ For instance, instead of displaying the `website` field as plain text, you could
374375
</DataTable.Col>
375376
<DataTable.Col source="phone" />
376377
- <DataTable.Col source="website" />
377-
+ <DataTable.Col source="website">
378-
+ <UrlField source="website" />
379-
+ </DataTable.Col>
378+
+ <DataTable.Col source="website" field={UrlField} />
380379
<DataTable.Col source="company.name" />
381380
</DataTable>
382381
```
@@ -421,10 +420,12 @@ You can use the `<MyUrlField>` component in `<UserList>` instead of react-admin'
421420
<DataTable>
422421
<DataTable.Col source="id" />
423422
<DataTable.Col source="name" />
424-
<DataTable.Col source="email" source={EmailField} />
423+
<DataTable.Col source="email">
424+
<EmailField source="email" />
425+
</DataTable.Col>
425426
<DataTable.Col source="phone" />
426-
- <DataTable.Col source="website" source={UrlField} />
427-
+ <DataTable.Col source="website" source={MyUrlField} />
427+
- <DataTable.Col source="website" field={UrlField} />
428+
+ <DataTable.Col source="website" field={MyUrlField} />
428429
<DataTable.Col source="company.name" />
429430
</DataTable>
430431
```

0 commit comments

Comments
 (0)