Skip to content

Commit 2637ada

Browse files
committed
replace all jsx snippet by tsx
1 parent c6e758a commit 2637ada

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

docs/Tutorial.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ JSONPlaceholder provides endpoints for users, posts, and comments. The admin we'
110110

111111
The `test-admin` project you just created already contains a data provider pre-configured for JSONPlaceholder.
112112

113-
```jsx
113+
```tsx
114114
// in src/dataProvider.ts
115115
import jsonServerProvider from 'ra-data-json-server';
116116

@@ -159,7 +159,7 @@ The `<ListGuesser>` component is not meant to be used in production - it's just
159159

160160
Let's copy this code, and create a new `UserList` component, in a new file named `users.tsx`:
161161

162-
```jsx
162+
```tsx
163163
// in src/users.tsx
164164
import { List, Datagrid, TextField, EmailField } from "react-admin";
165165

@@ -204,7 +204,7 @@ There is no visible change in the browser - except now, the app uses a component
204204

205205
Let's take a moment to analyze the code of the `<UserList>` component:
206206

207-
```jsx
207+
```tsx
208208
export const UserList = () => (
209209
<List>
210210
<Datagrid rowClick="edit">
@@ -223,7 +223,7 @@ export const UserList = () => (
223223

224224
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:
225225

226-
```jsx
226+
```tsx
227227
<List>
228228
{/* children */}
229229
</List>
@@ -235,7 +235,7 @@ But in most frameworks, "simple" means "limited", and it's hard to go beyond bas
235235

236236
This means we can compose `<List>` with another component - for instance `<SimpleList>`:
237237

238-
```jsx
238+
```tsx
239239
// in src/users.tsx
240240
import { List, SimpleList } from "react-admin";
241241

@@ -477,7 +477,7 @@ export const App = () => (
477477

478478
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:
479479

480-
```jsx
480+
```tsx
481481
// in src/posts.tsx
482482
import { List, Datagrid, TextField, ReferenceField } from "react-admin";
483483

@@ -587,7 +587,7 @@ Users can display the edit page just by clicking on the Edit button. The form is
587587

588588
Copy the `<PostEdit>` code dumped by the guesser in the console to the `posts.tsx` file so that you can customize the view:
589589

590-
```jsx
590+
```tsx
591591
// in src/posts.tsx
592592
import {
593593
List,
@@ -787,7 +787,7 @@ Let's get back to the post list for a minute. It offers sorting and pagination,
787787

788788
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:
789789

790-
```jsx
790+
```tsx
791791
// in src/posts.tsx
792792
const postFilters = [
793793
<TextInput source="q" label="Search" alwaysOn />,
@@ -818,7 +818,7 @@ Filters are "search-as-you-type", meaning that when the user enters new values i
818818

819819
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>`:
820820

821-
```jsx
821+
```tsx
822822
// in src/App.tsx
823823
import PostIcon from "@mui/icons-material/Book";
824824
import UserIcon from "@mui/icons-material/Group";
@@ -842,7 +842,7 @@ export const App = () => (
842842

843843
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.
844844

845-
```jsx
845+
```tsx
846846
// in src/Dashboard.tsx
847847
import { Card, CardContent, CardHeader } from "@mui/material";
848848

@@ -854,7 +854,7 @@ export const Dashboard = () => (
854854
);
855855
```
856856

857-
```jsx
857+
```tsx
858858
// in src/App.tsx
859859
import { Dashboard } from './Dashboard';
860860

@@ -916,7 +916,7 @@ export const authProvider: AuthProvider = {
916916

917917
To enable this authentication strategy, pass the `authProvider` to the `<Admin>` component:
918918

919-
```jsx
919+
```tsx
920920
// in src/App.tsx
921921
import { Dashboard } from './Dashboard';
922922
import { authProvider } from './authProvider';
@@ -1063,7 +1063,7 @@ export const dataProvider: DataProvider = {
10631063

10641064
Using this provider instead of the previous `jsonServerProvider` is just a matter of switching a function:
10651065

1066-
```jsx
1066+
```tsx
10671067
// in src/app.tsx
10681068
import { dataProvider } from './dataProvider';
10691069

0 commit comments

Comments
 (0)