Skip to content

Commit b4d41f8

Browse files
committed
update docs
1 parent 745107c commit b4d41f8

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

docs/router/framework/react/guide/navigation.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ Keep in mind that normally dynamic segment params are `string` values, but they
183183

184184
By default, all links are absolute unless a `from` route path is provided. This means that the above link will always navigate to the `/about` route regardless of what route you are currently on.
185185

186-
If you want to make a link that is relative to the current route, you can provide a `from` route path:
186+
Relative links will always apply to the current location. To make it relative to another route, you can provide a `from` route path:
187187

188188
```tsx
189189
const postIdRoute = createRoute({
@@ -201,9 +201,9 @@ As seen above, it's common to provide the `route.fullPath` as the `from` route p
201201

202202
### Special relative paths: `"."` and `".."`
203203

204-
Quite often you might want to reload the current location, for example, to rerun the loaders on the current and/or parent routes, or maybe there was a change in search parameters. This can be achieved by specifying a `to` route path of `"."` which will reload the current location. This is only applicable to the current location, and hence any `from` route path specified is ignored.
204+
Quite often you might want to reload the current location or another `from` path, for example, to rerun the loaders on the current and/or parent routes, or maybe navigate back to a parent route. This can be achieved by specifying a `to` route path of `"."` which will reload the current location or provided `from` path.
205205

206-
Another common need is to navigate one route back relative to the current location or some other matched route in the current tree. By specifying a `to` route path of `".."` navigation will be resolved to either the first parent route preceding the current location or, if specified, preceding the `"from"` route path.
206+
Another common need is to navigate one route back relative to the current location or another path. By specifying a `to` route path of `".."` navigation will be resolved to the first parent route preceding the current location.
207207

208208
```tsx
209209
export const Route = createFileRoute('/posts/$postId')({
@@ -214,7 +214,14 @@ function PostComponent() {
214214
return (
215215
<div>
216216
<Link to=".">Reload the current route of /posts/$postId</Link>
217-
<Link to="..">Navigate to /posts</Link>
217+
<Link to="..">Navigate back to /posts</Link>
218+
// the below are all equivalent
219+
<Link to="/posts">Navigate back to /posts</Link>
220+
<Link from="/posts" to=".">
221+
Navigate back to /posts
222+
</Link>
223+
// the below are all equivalent
224+
<Link to="/">Navigate to root</Link>
218225
<Link from="/posts" to="..">
219226
Navigate to root
220227
</Link>

0 commit comments

Comments
 (0)