@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/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
- TFrom extends keyof RegisteredRoutesInfo['routesById'] = TDefaultFrom,
480
- TTo extends string = '.',
481
- >(
482
- opts?: MakeLinkOptions<TFrom, TTo>,
483
- ) => {
484
- return router.navigate({ ...defaultOpts, ...(opts as any) })
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
- TFrom extends ValidFromPath<RegisteredRoutesInfo> = '/',
493
- TTo extends string = '.',
494
- >(
495
- opts: MakeUseMatchRouteOptions<TFrom, TTo>,
496
- ) => {
497
- const { pending, caseSensitive, ...rest } = opts
498
-
499
- return router.matchRoute(rest as any, {
500
- pending,
501
- caseSensitive,
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<