@tanstack/react-router 0.0.1-beta.37 → 0.0.1-beta.38

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tanstack/react-router",
3
3
  "author": "Tanner Linsley",
4
- "version": "0.0.1-beta.37",
4
+ "version": "0.0.1-beta.38",
5
5
  "license": "MIT",
6
6
  "repository": "tanstack/router",
7
7
  "homepage": "https://tanstack.com/router/",
package/src/index.tsx CHANGED
@@ -11,6 +11,7 @@ import {
11
11
  RegisteredRouter,
12
12
  RouterState,
13
13
  ToIdOption,
14
+ last,
14
15
  } from '@tanstack/router-core'
15
16
  import {
16
17
  warning,
@@ -563,12 +564,14 @@ export function useRoute<
563
564
  return router.useRoute(routeId as any) as any
564
565
  }
565
566
 
566
- export function useSearch<
567
- TId extends keyof RegisteredAllRouteInfo['routeInfoById'] = keyof RegisteredAllRouteInfo['routeInfoById'],
568
- >(_routeId?: TId): RegisteredAllRouteInfo['fullSearchSchema'] {
567
+ export function useSearch(): RegisteredAllRouteInfo['fullSearchSchema'] {
569
568
  return useRouter().state.currentLocation.search
570
569
  }
571
570
 
571
+ export function useParams(): RegisteredAllRouteInfo['allParams'] {
572
+ return last(useRouter().state.currentMatches)?.params as any
573
+ }
574
+
572
575
  export function linkProps<TTo extends string = '.'>(
573
576
  props: MakeLinkPropsOptions<RegisteredAllRouteInfo, '/', TTo>,
574
577
  ): React.AnchorHTMLAttributes<HTMLAnchorElement> {