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
The root component, `<List>`, reads the query parameters from the URL, calls the API based on these parameters, and puts the result in a React context. It also builds a set of callbacks allowing child components to modify the list filters, pagination, and sorting. `<List>` does a lot of things, yet its syntax couldn't be simpler:
225
225
226
-
```jsx
226
+
```tsx
227
227
<List>
228
228
{/* children */}
229
229
</List>
@@ -235,7 +235,7 @@ But in most frameworks, "simple" means "limited", and it's hard to go beyond bas
235
235
236
236
This means we can compose `<List>` with another component - for instance `<SimpleList>`:
237
237
238
-
```jsx
238
+
```tsx
239
239
// in src/users.tsx
240
240
import { List, SimpleList } from"react-admin";
241
241
@@ -477,7 +477,7 @@ export const App = () => (
477
477
478
478
The `ListGuesser` suggests using a `<ReferenceField>` for the `userId` field. Let's play with this new field by creating the `PostList` component based on the code dumped by the guesser:
@@ -587,7 +587,7 @@ Users can display the edit page just by clicking on the Edit button. The form is
587
587
588
588
Copy the `<PostEdit>` code dumped by the guesser in the console to the `posts.tsx` file so that you can customize the view:
589
589
590
-
```jsx
590
+
```tsx
591
591
// in src/posts.tsx
592
592
import {
593
593
List,
@@ -787,7 +787,7 @@ Let's get back to the post list for a minute. It offers sorting and pagination,
787
787
788
788
React-admin can use Input components to create a multi-criteria search engine in the list view. Pass an array of such Input components to the List `filters` prop to enable filtering:
789
789
790
-
```jsx
790
+
```tsx
791
791
// in src/posts.tsx
792
792
const postFilters = [
793
793
<TextInputsource="q"label="Search"alwaysOn />,
@@ -818,7 +818,7 @@ Filters are "search-as-you-type", meaning that when the user enters new values i
818
818
819
819
The sidebar menu shows the same icon for both posts and users. Customizing the menu icon is just a matter of passing an `icon` attribute to each `<Resource>`:
820
820
821
-
```jsx
821
+
```tsx
822
822
// in src/App.tsx
823
823
importPostIconfrom"@mui/icons-material/Book";
824
824
importUserIconfrom"@mui/icons-material/Group";
@@ -842,7 +842,7 @@ export const App = () => (
842
842
843
843
By default, react-admin displays the list page of the first `Resource` element as home page. If you want to display a custom component instead, pass it in the `dashboard` prop of the `<Admin>` component.
0 commit comments