@tanstack/react-router 0.0.1-beta.66 → 0.0.1-beta.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/index.js +4 -4
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.js +4 -4
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +48 -48
- package/build/umd/index.development.js +4 -4
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +2 -2
- package/build/umd/index.production.js.map +1 -1
- package/package.json +2 -2
- package/src/index.tsx +27 -21
package/src/index.tsx
CHANGED
|
@@ -475,32 +475,38 @@ export function useNavigate<
|
|
|
475
475
|
TDefaultFrom extends keyof RegisteredRoutesInfo['routesById'] = '/',
|
|
476
476
|
>(defaultOpts?: { from?: TDefaultFrom }) {
|
|
477
477
|
const router = useRouterContext()
|
|
478
|
-
return
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
478
|
+
return React.useCallback(
|
|
479
|
+
<
|
|
480
|
+
TFrom extends keyof RegisteredRoutesInfo['routesById'] = TDefaultFrom,
|
|
481
|
+
TTo extends string = '.',
|
|
482
|
+
>(
|
|
483
|
+
opts?: MakeLinkOptions<TFrom, TTo>,
|
|
484
|
+
) => {
|
|
485
|
+
return router.navigate({ ...defaultOpts, ...(opts as any) })
|
|
486
|
+
},
|
|
487
|
+
[],
|
|
488
|
+
)
|
|
486
489
|
}
|
|
487
490
|
|
|
488
491
|
export function useMatchRoute() {
|
|
489
492
|
const router = useRouterContext()
|
|
490
493
|
|
|
491
|
-
return
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
494
|
+
return React.useCallback(
|
|
495
|
+
<
|
|
496
|
+
TFrom extends ValidFromPath<RegisteredRoutesInfo> = '/',
|
|
497
|
+
TTo extends string = '.',
|
|
498
|
+
>(
|
|
499
|
+
opts: MakeUseMatchRouteOptions<TFrom, TTo>,
|
|
500
|
+
) => {
|
|
501
|
+
const { pending, caseSensitive, ...rest } = opts
|
|
502
|
+
|
|
503
|
+
return router.matchRoute(rest as any, {
|
|
504
|
+
pending,
|
|
505
|
+
caseSensitive,
|
|
506
|
+
})
|
|
507
|
+
},
|
|
508
|
+
[],
|
|
509
|
+
)
|
|
504
510
|
}
|
|
505
511
|
|
|
506
512
|
export function MatchRoute<
|