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/Tutorial.md
+13-54
Original file line number
Diff line number
Diff line change
@@ -17,18 +17,24 @@ Here is an overview of the result:
17
17
18
18
## Setting Up
19
19
20
-
React-admin uses React. We'll use [Vite](https://vitejs.dev/) to create an empty React app, and install the `react-admin` package:
20
+
React-admin uses React. We'll use [create-react-admin](https://github.com/marmelab/react-admin/tree/master/packages/create-react-admin) to bootstrap a new admin:
21
21
22
22
```sh
23
-
yarn create vite test-admin --template react-ts
24
-
cd test-admin/
25
-
yarn add react-admin ra-data-json-server
23
+
yarn create react-admin test-admin
24
+
```
25
+
26
+
Choose **JSON Server** as the data provider, then **None** as the auth provider. Don't add any resource for now and just press **Enter**. Finally, choose either `npm` or `yarn` and press **Enter**. Once everything is installed, enter the following commands:
27
+
28
+
```sh
29
+
cd test-admin
30
+
npm run dev
31
+
# or
26
32
yarn dev
27
33
```
28
34
29
-
You should be up and running with an empty React application on port 5173.
35
+
You should be up and running with an empty React admin application on port 5173.
30
36
31
-
**Tip**: Although this tutorial uses a TypeScript template, you can use react-admin with JavaScript if you prefer. Also, you can use [create-react-app](./CreateReactApp.md), [Next.js](./NextJs.md), [Remix](./Remix.md), or any other React framework to create your admin app. React-admin is framework-agnostic.
37
+
**Tip**: Although this tutorial uses a TypeScript template, you can use react-admin with JavaScript if you prefer. Also, you can use [Vite](https://vitejs.dev/), [create-react-app](./CreateReactApp.md), [Next.js](./NextJs.md), [Remix](./Remix.md), or any other React framework to create your admin app. React-admin is framework-agnostic.
32
38
33
39
## Using an API As Data Source
34
40
@@ -70,57 +76,10 @@ JSONPlaceholder provides endpoints for users, posts, and comments. The admin we'
70
76
71
77
## Making Contact With The API Using a Data Provider
72
78
73
-
Bootstrap the admin app by replacing the `src/App.tsx` by the following code:
**Tip:** You can also install the `Roboto` font locally by following the instructions from the [Material UI starter guide](https://mui.com/material-ui/getting-started/installation/#roboto-font).
123
-
124
83
The `<App>` component renders an `<Admin>` component, which is the root component of a react-admin application. This component expects a `dataProvider` prop - a function capable of fetching data from an API. Since there is no standard for data exchanges between computers, you will probably have to write a custom provider to connect react-admin to your own APIs - but we'll dive into Data Providers later. For now, let's take advantage of the `ra-data-json-server` data provider, which speaks the same REST dialect as JSONPlaceholder.
0 commit comments