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/router/decisions-on-dx.md
+3-34Lines changed: 3 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -93,17 +93,7 @@ This only gets worse as you begin to use more features of the router, such as ne
93
93
94
94
What we found to be the best way to define your routes is to abstract the definition of the route configuration outside of the route-tree. Then stitch together your route configurations into a single cohesive route-tree that is then passed into the `createRouter` function.
95
95
96
-
<!-- ::start:framework -->
97
-
98
-
# React
99
-
100
-
You can read more about [code-based routing](./framework/react/routing/code-based-routing.md) to see how to define your routes in this way.
101
-
102
-
# Solid
103
-
104
-
You can read more about [code-based routing](./framework/solid/routing/code-based-routing.md) to see how to define your routes in this way.
105
-
106
-
<!-- ::end:framework -->
96
+
You can read more about [code-based routing](./routing/code-based-routing.md) to see how to define your routes in this way.
107
97
108
98
> [!TIP]
109
99
> Finding Code-based routing to be a bit too cumbersome? See why [file-based routing](#why-is-file-based-routing-the-preferred-way-to-define-routes) is the preferred way to define your routes.
@@ -172,19 +162,8 @@ We went with **module declaration**, as it is what we found to be the most scala
172
162
173
163
Something you'll notice (quite soon) in the TanStack Router documentation is that we push for **file-based routing** as the preferred method for defining your routes. This is because we've found that file-based routing is the most scalable and maintainable way to define your routes.
174
164
175
-
<!-- ::start:framework -->
176
-
177
-
# React
178
-
179
-
> [!TIP]
180
-
> Before you continue, it's important you have a good understanding of [code-based routing](./framework/react/routing/code-based-routing.md) and [file-based routing](./framework/react/routing/file-based-routing.md).
181
-
182
-
# Solid
183
-
184
165
> [!TIP]
185
-
> Before you continue, it's important you have a good understanding of [code-based routing](./framework/solid/routing/code-based-routing.md) and [file-based routing](./framework/solid/routing/file-based-routing.md).
186
-
187
-
<!-- ::end:framework -->
166
+
> Before you continue, it's important you have a good understanding of [code-based routing](./routing/code-based-routing.md) and [file-based routing](./routing/file-based-routing.md).
188
167
189
168
As mentioned in the beginning, TanStack Router was designed for complex applications that require a high degree of type-safety and maintainability. And to achieve this, the configuration of the router has been done in a precise way that allows TypeScript to infer the types of your routes as much as possible.
190
169
@@ -258,14 +237,4 @@ That's it! No need to worry about defining the `getParentRoute` function, stitch
258
237
259
238
At no point does the TanStack Router Bundler Plugin take away your control over your route configurations. It's designed to be as flexible as possible, allowing you to define your routes in a way that suits your application whilst reducing the boilerplate and complexity of the route configuration.
260
239
261
-
<!-- ::start:framework -->
262
-
263
-
# React
264
-
265
-
Check out the guides for [file-based routing](./framework/react/routing/file-based-routing.md) and [code-splitting](./framework/react/guide/code-splitting.md) for a more in-depth explanation of how they work in TanStack Router.
266
-
267
-
# Solid
268
-
269
-
Check out the guides for [file-based routing](./framework/solid/routing/file-based-routing.md) and [code-splitting](./framework/solid/guide/code-splitting.md) for a more in-depth explanation of how they work in TanStack Router.
270
-
271
-
<!-- ::end:framework -->
240
+
Check out the guides for [file-based routing](./routing/file-based-routing.md) and [code-splitting](./guide/code-splitting.md) for a more in-depth explanation of how they work in TanStack Router.
Copy file name to clipboardExpand all lines: docs/router/faq.md
+1-12Lines changed: 1 addition & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,18 +27,7 @@ You should commit this file into git so that other developers can use it to buil
27
27
## Can I conditionally render the Root Route component?
28
28
29
29
No, the root route is always rendered as it is the entry point of your application.
30
-
31
-
<!-- ::start:framework -->
32
-
33
-
# React
34
-
35
-
If you need to conditionally render a route's component, this usually means that the page content needs to be different based on some condition (e.g. user authentication). For this use case, you should use a [Layout Route](./framework/react/routing/routing-concepts.md#layout-routes) or a [Pathless Layout Route](./framework/react/routing/routing-concepts.md#pathless-layout-routes) to conditionally render the content.
36
-
37
-
# Solid
38
-
39
-
If you need to conditionally render a route's component, this usually means that the page content needs to be different based on some condition (e.g. user authentication). For this use case, you should use a [Layout Route](./framework/solid/routing/routing-concepts.md#layout-routes) or a [Pathless Layout Route](./framework/solid/routing/routing-concepts.md#pathless-layout-routes) to conditionally render the content.
40
-
41
-
<!-- ::end:framework -->
30
+
If you need to conditionally render a route's component, this usually means that the page content needs to be different based on some condition (e.g. user authentication). For this use case, you should use a [Layout Route](./routing/routing-concepts.md#layout-routes) or a [Pathless Layout Route](./routing/routing-concepts.md#pathless-layout-routes) to conditionally render the content.
42
31
43
32
You can restrict access to these routes using a conditional check in the `beforeLoad` function of the route.
Copy file name to clipboardExpand all lines: docs/router/framework/react/installation/migrate-from-react-location.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,27 +2,27 @@
2
2
title: Migration from React Location
3
3
---
4
4
5
-
Before you begin your journey in migrating from React Location, it's important that you have a good understanding of the [Routing Concepts](../routing/routing-concepts.md) and [Design Decisions](../decisions-on-dx.md) used by TanStack Router.
5
+
Before you begin your journey in migrating from React Location, it's important that you have a good understanding of the [Routing Concepts](../../../routing/routing-concepts.md) and [Design Decisions](../../../decisions-on-dx.md) used by TanStack Router.
6
6
7
7
## Differences between React Location and TanStack Router
8
8
9
9
React Location and TanStack Router share much of same design decisions concepts, but there are some key differences that you should be aware of.
10
10
11
11
- React Location uses _generics_ to infer types for routes, while TanStack Router uses _module declaration merging_ to infer types.
12
-
- Route configuration in React Location is done using a single array of route definitions, while in TanStack Router, route configuration is done using a tree of route definitions starting with the [root route](../routing/routing-concepts.md#the-root-route).
13
-
-[File-based routing](../routing/file-based-routing.md) is the recommended way to define routes in TanStack Router, while React Location only allows you to define routes in a single file using a code-based approach.
14
-
- TanStack Router does support a [code-based approach](../routing/code-based-routing.md) to defining routes, but it is not recommended for most use cases. You can read more about why, over here: [why is file-based routing the preferred way to define routes?](../decisions-on-dx.md#why-is-file-based-routing-the-preferred-way-to-define-routes)
12
+
- Route configuration in React Location is done using a single array of route definitions, while in TanStack Router, route configuration is done using a tree of route definitions starting with the [root route](../../../routing/routing-concepts.md#the-root-route).
13
+
-[File-based routing](../../../routing/file-based-routing.md) is the recommended way to define routes in TanStack Router, while React Location only allows you to define routes in a single file using a code-based approach.
14
+
- TanStack Router does support a [code-based approach](../../../routing/code-based-routing.md) to defining routes, but it is not recommended for most use cases. You can read more about why, over here: [why is file-based routing the preferred way to define routes?](../../../decisions-on-dx.md#why-is-file-based-routing-the-preferred-way-to-define-routes)
15
15
16
16
## Migration guide
17
17
18
18
In this guide we'll go over the process of migrating the [React Location Basic example](https://github.com/TanStack/router/tree/react-location/examples/basic) over to TanStack Router using file-based routing, with the end goal of having the same functionality as the original example (styling and other non-routing related code will be omitted).
19
19
20
20
> [!TIP]
21
-
> To use a code-based approach for defining your routes, you can read the [code-based Routing](../routing/code-based-routing.md) guide.
21
+
> To use a code-based approach for defining your routes, you can read the [code-based Routing](../../../routing/code-based-routing.md) guide.
22
22
23
23
### Step 1: Swap over to TanStack Router's dependencies
24
24
25
-
First, we need to install the dependencies for TanStack Router. For detailed installation instructions, see our [How to Install TanStack Router](../how-to/install.md) guide.
25
+
First, we need to install the dependencies for TanStack Router. For detailed installation instructions, see our [How to Install TanStack Router](../../../how-to/install.md) guide.
However, if your application does not use Vite, you use one of our other [supported bundlers](../routing/file-based-routing.md#getting-started-with-file-based-routing), or you can use the `@tanstack/router-cli` package to watch for changes in your routes files and automatically update the routes configuration.
60
+
However, if your application does not use Vite, you use one of our other [supported bundlers](../../../routing/file-based-routing.md#getting-started-with-file-based-routing), or you can use the `@tanstack/router-cli` package to watch for changes in your routes files and automatically update the routes configuration.
61
61
62
62
### Step 3: Add the file-based configuration file to your project
63
63
@@ -70,7 +70,7 @@ Create a `tsr.config.json` file in the root of your project with the following c
70
70
}
71
71
```
72
72
73
-
You can find the full list of options for the `tsr.config.json` file [here](../routing/file-based-routing.md).
73
+
You can find the full list of options for the `tsr.config.json` file [here](../../../routing/file-based-routing.md).
Copy file name to clipboardExpand all lines: docs/router/integrations/query.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ title: TanStack Query Integration
4
4
---
5
5
6
6
> [!IMPORTANT]
7
-
> This integration automates SSR dehydration/hydration and streaming between TanStack Router and TanStack Query. If you haven't read the standard [External Data Loading](../framework/react/guide/external-data-loading.md) guide, start there.
7
+
> This integration automates SSR dehydration/hydration and streaming between TanStack Router and TanStack Query. If you haven't read the standard [External Data Loading](../guide/external-data-loading.md) guide, start there.
0 commit comments