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
Now, start the server with `yarn dev`, browse to `http://localhost:3000/`, and you should see the working admin:
@@ -107,19 +110,22 @@ Now, start the server with `yarn dev`, browse to `http://localhost:3000/`, and y
107
110
108
111
Starting from there, you can [Add an API](#adding-an-api) as described in the next section, and/or add features to the Next.js app, as explained in the [Getting started tutorial](./Tutorial.md)
109
112
110
-
## Specific Use Cases For Pages Router
111
-
112
-
### Rendering React-Admin In A Sub Route
113
+
## Rendering React-Admin In A Sub Route
113
114
114
115
In many cases, the admin is only a part of the application. For instance, you may want to render the admin in a subpath, e.g. `/admin`.
115
116
116
-
Next.js makes it trivial: create a `src/pages/admin.tsx` file with the same content as in the previous section:
117
+
Depending of the router system you choose, create the subpage in this following file:
118
+
- you choose **App Router**: create the subpage in `src/app/admin/page.tsx`
119
+
- you choose **Pages Router**: create the subpage in `src/pages/admin/index.tsx`
120
+
121
+
No matter which system you choose, the file should contains the following code:
117
122
118
123
```tsx
119
-
// in src/pages/admin.tsx
120
-
importtype, { NextPage } from"next";
124
+
// depending of the Router you choose:
125
+
// - in src/app/admin/page.tsx for App Router system
126
+
// - or in src/pages/admin/index.tsx for Pages Router system
0 commit comments