Skip to content

Commit 51da7fb

Browse files
Docs(Relative Navigation): add extra context around the from location (#5424)
* add extra context * ci: apply automated fixes * add code rabbit suggestion --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 4f288bf commit 51da7fb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,11 @@ By default, all links are absolute unless a `from` route path is provided. This
185185

186186
Relative links can be combined with a `from` route path. If a from route path isn't provided, relative paths default to the current active location.
187187

188+
> [!NOTE]
189+
> Keep in mind that when calling useNavigate as a method on the route, for example `Route.useNavigate`, then the `from` location is predefined to be the route it's called on.
190+
>
191+
> Another common pitfall is when using this in a pathless layout route, since the pathless layout route does not have an actual path, the `from` location is regarded as the parent of the pathless layout route. Hence relative routing will be resolved from this parent.
192+
188193
```tsx
189194
const postIdRoute = createRoute({
190195
path: '/blog/post/$postId',

0 commit comments

Comments
 (0)