@tanstack/react-router 0.0.1-alpha.5 → 0.0.1-alpha.6
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/react-router/src/index.js +12 -12
- package/build/cjs/react-router/src/index.js.map +1 -1
- package/build/cjs/router-core/build/esm/index.js +9 -4
- package/build/cjs/router-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +22 -13
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +29 -29
- package/build/types/index.d.ts +1 -5
- package/build/umd/index.development.js +21 -16
- 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 +2 -2
- package/src/index.tsx +13 -13
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-alpha.
|
|
4
|
+
"version": "0.0.1-alpha.6",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "tanstack/router",
|
|
7
7
|
"homepage": "https://react-router.tanstack.com/",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@babel/runtime": "^7.16.7",
|
|
43
|
-
"@tanstack/router-core": "0.0.1-alpha.
|
|
43
|
+
"@tanstack/router-core": "0.0.1-alpha.6",
|
|
44
44
|
"use-sync-external-store": "^1.2.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
package/src/index.tsx
CHANGED
|
@@ -415,7 +415,7 @@ export function RouterProvider<
|
|
|
415
415
|
)
|
|
416
416
|
}
|
|
417
417
|
|
|
418
|
-
|
|
418
|
+
function useRouter(): Router {
|
|
419
419
|
const value = React.useContext(routerContext)
|
|
420
420
|
warning(!value, 'useRouter must be used inside a <Router> component!')
|
|
421
421
|
|
|
@@ -424,21 +424,21 @@ export function useRouter(): Router {
|
|
|
424
424
|
return value.router as Router
|
|
425
425
|
}
|
|
426
426
|
|
|
427
|
-
|
|
427
|
+
function useMatches(): RouteMatch[] {
|
|
428
428
|
return React.useContext(matchesContext)
|
|
429
429
|
}
|
|
430
430
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
|
|
431
|
+
// function useParentMatches(): RouteMatch[] {
|
|
432
|
+
// const router = useRouter()
|
|
433
|
+
// const match = useMatch()
|
|
434
|
+
// const matches = router.state.matches
|
|
435
|
+
// return matches.slice(
|
|
436
|
+
// 0,
|
|
437
|
+
// matches.findIndex((d) => d.matchId === match.matchId) - 1,
|
|
438
|
+
// )
|
|
439
|
+
// }
|
|
440
|
+
|
|
441
|
+
function useMatch<T>(): RouteMatch {
|
|
442
442
|
return useMatches()?.[0] as RouteMatch
|
|
443
443
|
}
|
|
444
444
|
|