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/start/framework/react/migrate-from-next-js.md
+41-18Lines changed: 41 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -10,21 +10,44 @@ This guide provides a step-by-step process to migrate a project from the Next.js
10
10
11
11
## Step-by-Step (Basics)
12
12
13
-
This step-by-step guide should give you an overview of how to migrate your Next.js App Router project to TanStack Start by migrating a starter template. The goal is to help you understand the basic steps involved in the migration process, so you can adapt them to your specific project needs.
13
+
This step-by-step guide provides an overview of how to migrate your Next.js App Router project to TanStack Start using a starter template. The goal is to help you understand the basic steps involved in the migration process so you can adapt them to your specific project needs.
14
14
15
15
### Prerequisites
16
16
17
-
Let's start off by cloning the following [starter template](https://github.com/nrjdalal/awesome-templates/tree/main/next.js-apps/next.js-start) to follow along with this guide:
17
+
Before we begin, this guide assumes your project structure looks like this:
18
+
19
+
```txt
20
+
.
21
+
├── next.config.ts
22
+
├── package.json
23
+
├── postcss.config.mjs
24
+
├── public
25
+
│ ├── file.svg
26
+
│ ├── globe.svg
27
+
│ ├── next.svg
28
+
│ ├── vercel.svg
29
+
│ └── window.svg
30
+
├── README.md
31
+
├── src
32
+
│ └── app
33
+
│ ├── favicon.ico
34
+
│ ├── globals.css
35
+
│ ├── layout.tsx
36
+
│ └── page.tsx
37
+
└── tsconfig.json
38
+
```
39
+
40
+
Alternatively, you can follow along by cloning the following [starter template](https://github.com/nrjdalal/awesome-templates/tree/main/next.js-apps/next.js-start):
By default, `routesDirectory` is set to `src/routes`. If you want to maintain consistency with Next.js App Router conventions, you can set it to `src/app` instead.
118
+
By default, `routesDirectory` is set to `src/routes`. To maintain consistency with Next.js App Router conventions, you can set it to `src/app` instead.
96
119
97
120
### 4. Adapt the Root Layout
98
121
99
-
> TanStack Start uses routing adjacent to Remix, with some changes to make it compatible with nested structures and support special features using tokens. Learn more about it at [Routing Concepts](/router/latest/docs/framework/react/routing/routing-concepts) guide.
122
+
> TanStack Start uses a routing approach similar to Remix, with some changes to support nested structures and special features using tokens. Learn more about it at [Routing Concepts](/router/latest/docs/framework/react/routing/routing-concepts) guide.
100
123
101
-
Instead of `layout.tsx`, you will create a file named `__root.tsx` in the `src/app` directory. This file will serve as the root layout for your application.
124
+
Instead of `layout.tsx`, create a file named `__root.tsx` in the `src/app` directory. This file will serve as the root layout for your application.
102
125
103
126
-`src/app/layout.tsx` to `src/app/__root.tsx`
104
127
@@ -158,7 +181,7 @@ function RootLayout() {
158
181
159
182
### 5. Adapt the Home Page
160
183
161
-
Instead of `page.tsx`, you will create an `index.tsx` file for the `/` route.
184
+
Instead of `page.tsx`, create an `index.tsx` file for the `/` route.
162
185
163
186
-`src/app/page.tsx` to `src/app/index.tsx`
164
187
@@ -193,7 +216,7 @@ Instead of `page.tsx`, you will create an `index.tsx` file for the `/` route.
193
216
194
217
### 6. Are we migrated yet?
195
218
196
-
One last thing before we can run the development server, we need to create a router file that will dictate the behavior of TanStack Router used within TanStack Start.
219
+
Before you can run the development server, you need to create a router file that will define the behavior of TanStack Router within TanStack Start.
> 🧠 Here you can configure everything from the default [preloading functionality](/router/latest/docs/framework/react/guide/preloading) to [caching staleness](/router/latest/docs/framework/react/guide/data-loading).
221
244
222
-
Don't worry if you see some TypeScript errors at this point. The next step will fix that.
245
+
Don't worry if you see some TypeScript errors at this point; the next step will resolve them.
223
246
224
247
### 7. Verify the Migration
225
248
@@ -229,9 +252,9 @@ Run the development server:
229
252
npmrundev
230
253
```
231
254
232
-
Then visit `http://localhost:3000`. You should see the TanStack Start welcome page with its logo and documentation link.
255
+
Then, visit `http://localhost:3000`. You should see the TanStack Start welcome page with its logo and a documentation link.
0 commit comments