@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/build/cjs/index.js +6 -1
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.js +7 -3
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +48 -48
- package/build/types/index.d.ts +3 -2
- package/build/umd/index.development.js +6 -1
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +1 -1
- package/src/index.tsx +6 -3
package/package.json
CHANGED
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> {
|