@tanstack/react-router 1.5.4 → 1.5.5
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/Matches.js +15 -14
- package/build/cjs/Matches.js.map +1 -1
- package/build/cjs/RouterProvider.js +6 -27
- package/build/cjs/RouterProvider.js.map +1 -1
- package/build/cjs/awaited.js +2 -2
- package/build/cjs/awaited.js.map +1 -1
- package/build/cjs/index.js +11 -7
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/link.js +4 -3
- package/build/cjs/link.js.map +1 -1
- package/build/cjs/router.js.map +1 -1
- package/build/cjs/routerContext.js +42 -0
- package/build/cjs/routerContext.js.map +1 -0
- package/build/cjs/scroll-restoration.js +3 -3
- package/build/cjs/scroll-restoration.js.map +1 -1
- package/build/cjs/useBlocker.js +2 -2
- package/build/cjs/useBlocker.js.map +1 -1
- package/build/cjs/useNavigate.js +3 -3
- package/build/cjs/useNavigate.js.map +1 -1
- package/build/cjs/useParams.js +2 -2
- package/build/cjs/useParams.js.map +1 -1
- package/build/cjs/useRouteContext.js +23 -0
- package/build/cjs/useRouteContext.js.map +1 -0
- package/build/cjs/useRouter.js +44 -0
- package/build/cjs/useRouter.js.map +1 -0
- package/build/cjs/useRouterState.js +24 -0
- package/build/cjs/useRouterState.js.map +1 -0
- package/build/cjs/utils.js +0 -8
- package/build/cjs/utils.js.map +1 -1
- package/build/esm/index.js +192 -188
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +582 -431
- package/build/types/RouterProvider.d.ts +2 -13
- package/build/types/index.d.ts +4 -1
- package/build/types/router.d.ts +6 -5
- package/build/types/routerContext.d.ts +3 -0
- package/build/types/useRouteContext.d.ts +7 -0
- package/build/types/useRouter.d.ts +5 -0
- package/build/types/useRouterState.d.ts +6 -0
- package/build/types/utils.d.ts +0 -6
- package/build/umd/index.development.js +367 -363
- 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/Matches.tsx +2 -1
- package/src/RouterProvider.tsx +8 -60
- package/src/awaited.tsx +1 -1
- package/src/index.tsx +4 -2
- package/src/link.tsx +8 -7
- package/src/router.ts +18 -5
- package/src/routerContext.tsx +11 -0
- package/src/scroll-restoration.tsx +1 -1
- package/src/useBlocker.tsx +1 -1
- package/src/useNavigate.tsx +1 -1
- package/src/useParams.tsx +1 -1
- package/src/useRouteContext.ts +24 -0
- package/src/useRouter.tsx +20 -0
- package/src/useRouterState.tsx +17 -0
- package/src/utils.ts +0 -24
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-router",
|
|
3
3
|
"author": "Tanner Linsley",
|
|
4
|
-
"version": "1.5.
|
|
4
|
+
"version": "1.5.5",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "tanstack/router",
|
|
7
7
|
"homepage": "https://tanstack.com/router",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@tanstack/store": "^0.1.3",
|
|
45
45
|
"tiny-invariant": "^1.3.1",
|
|
46
46
|
"tiny-warning": "^1.0.3",
|
|
47
|
-
"@tanstack/history": "1.5.
|
|
47
|
+
"@tanstack/history": "1.5.5"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "rollup --config rollup.config.js"
|
package/src/Matches.tsx
CHANGED
|
@@ -2,7 +2,8 @@ import * as React from 'react'
|
|
|
2
2
|
import invariant from 'tiny-invariant'
|
|
3
3
|
import warning from 'tiny-warning'
|
|
4
4
|
import { CatchBoundary, ErrorComponent } from './CatchBoundary'
|
|
5
|
-
import {
|
|
5
|
+
import { useRouterState } from './useRouterState'
|
|
6
|
+
import { useRouter } from './useRouter'
|
|
6
7
|
import { ResolveRelativePath, ToOptions } from './link'
|
|
7
8
|
import { AnyRoute, ReactNode, RootSearchSchema } from './route'
|
|
8
9
|
import {
|
package/src/RouterProvider.tsx
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
|
-
import warning from 'tiny-warning'
|
|
3
|
-
import { useStore } from '@tanstack/react-store'
|
|
4
2
|
import { Matches } from './Matches'
|
|
5
|
-
import { NavigateOptions,
|
|
3
|
+
import { NavigateOptions, ToOptions } from './link'
|
|
6
4
|
import { ParsedLocation } from './location'
|
|
7
5
|
import { AnyRoute } from './route'
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Router,
|
|
13
|
-
RouterOptions,
|
|
14
|
-
RouterState,
|
|
15
|
-
} from './router'
|
|
16
|
-
import { NoInfer, pick, useLayoutEffect } from './utils'
|
|
17
|
-
import { MatchRouteOptions } from './Matches'
|
|
6
|
+
import { RoutePaths } from './routeInfo'
|
|
7
|
+
import { RegisteredRouter, Router, RouterOptions, RouterState } from './router'
|
|
8
|
+
import { pick, useLayoutEffect } from './utils'
|
|
9
|
+
|
|
18
10
|
import { RouteMatch } from './Matches'
|
|
11
|
+
import { useRouter } from './useRouter'
|
|
12
|
+
import { useRouterState } from './useRouterState'
|
|
13
|
+
import { routerContext } from './routerContext'
|
|
19
14
|
|
|
20
15
|
const useTransition =
|
|
21
16
|
React.useTransition ||
|
|
@@ -48,31 +43,12 @@ export type NavigateFn<TRouteTree extends AnyRoute> = <
|
|
|
48
43
|
opts: NavigateOptions<TRouteTree, TFrom, TTo, TMaskFrom, TMaskTo>,
|
|
49
44
|
) => Promise<void>
|
|
50
45
|
|
|
51
|
-
export type MatchRouteFn<TRouteTree extends AnyRoute> = <
|
|
52
|
-
TFrom extends RoutePaths<TRouteTree> = '/',
|
|
53
|
-
TTo extends string = '',
|
|
54
|
-
TResolved = ResolveRelativePath<TFrom, NoInfer<TTo>>,
|
|
55
|
-
>(
|
|
56
|
-
location: ToOptions<TRouteTree, TFrom, TTo>,
|
|
57
|
-
opts?: MatchRouteOptions,
|
|
58
|
-
) => false | RouteById<TRouteTree, TResolved>['types']['allParams']
|
|
59
|
-
|
|
60
46
|
export type BuildLocationFn<TRouteTree extends AnyRoute> = (
|
|
61
47
|
opts: ToOptions<TRouteTree>,
|
|
62
48
|
) => ParsedLocation
|
|
63
49
|
|
|
64
50
|
export type InjectedHtmlEntry = string | (() => Promise<string> | string)
|
|
65
51
|
|
|
66
|
-
export let routerContext = React.createContext<Router<any>>(null!)
|
|
67
|
-
|
|
68
|
-
if (typeof document !== 'undefined') {
|
|
69
|
-
if (window.__TSR_ROUTER_CONTEXT__) {
|
|
70
|
-
routerContext = window.__TSR_ROUTER_CONTEXT__
|
|
71
|
-
} else {
|
|
72
|
-
window.__TSR_ROUTER_CONTEXT__ = routerContext as any
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
52
|
export function RouterProvider<
|
|
77
53
|
TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
|
|
78
54
|
TDehydrated extends Record<string, any> = Record<string, any>,
|
|
@@ -234,19 +210,6 @@ export function getRouteMatch<TRouteTree extends AnyRoute>(
|
|
|
234
210
|
].find((d) => d.id === id)
|
|
235
211
|
}
|
|
236
212
|
|
|
237
|
-
export function useRouterState<
|
|
238
|
-
TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
|
|
239
|
-
TSelected = RouterState<TRouteTree>,
|
|
240
|
-
>(opts?: {
|
|
241
|
-
router?: Router<TRouteTree>
|
|
242
|
-
select: (state: RouterState<RegisteredRouter['routeTree']>) => TSelected
|
|
243
|
-
}): TSelected {
|
|
244
|
-
const contextRouter = useRouter<TRouteTree>({
|
|
245
|
-
warn: opts?.router === undefined,
|
|
246
|
-
})
|
|
247
|
-
return useStore((opts?.router || contextRouter).__store, opts?.select as any)
|
|
248
|
-
}
|
|
249
|
-
|
|
250
213
|
export type RouterProps<
|
|
251
214
|
TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
|
|
252
215
|
TDehydrated extends Record<string, any> = Record<string, any>,
|
|
@@ -254,18 +217,3 @@ export type RouterProps<
|
|
|
254
217
|
router: Router<TRouteTree>
|
|
255
218
|
context?: Partial<RouterOptions<TRouteTree, TDehydrated>['context']>
|
|
256
219
|
}
|
|
257
|
-
|
|
258
|
-
export function useRouter<
|
|
259
|
-
TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
|
|
260
|
-
>(opts?: { warn?: boolean }): Router<TRouteTree> {
|
|
261
|
-
const resolvedContext =
|
|
262
|
-
typeof document !== 'undefined'
|
|
263
|
-
? window.__TSR_ROUTER_CONTEXT__ || routerContext
|
|
264
|
-
: routerContext
|
|
265
|
-
const value = React.useContext(resolvedContext)
|
|
266
|
-
warning(
|
|
267
|
-
!((opts?.warn ?? true) && !value),
|
|
268
|
-
'useRouter must be used inside a <RouterProvider> component!',
|
|
269
|
-
)
|
|
270
|
-
return value as any
|
|
271
|
-
}
|
package/src/awaited.tsx
CHANGED
package/src/index.tsx
CHANGED
|
@@ -7,8 +7,6 @@ export * from './defer'
|
|
|
7
7
|
export * from './CatchBoundary'
|
|
8
8
|
export * from './fileRoute'
|
|
9
9
|
export * from './history'
|
|
10
|
-
export * from './index'
|
|
11
|
-
// export * from './injectHtml'
|
|
12
10
|
export * from './lazyRouteComponent'
|
|
13
11
|
export * from './link'
|
|
14
12
|
export * from './location'
|
|
@@ -26,4 +24,8 @@ export * from './useBlocker'
|
|
|
26
24
|
export * from './useNavigate'
|
|
27
25
|
export * from './useParams'
|
|
28
26
|
export * from './useSearch'
|
|
27
|
+
export * from './routerContext'
|
|
28
|
+
export * from './useRouteContext'
|
|
29
|
+
export * from './useRouter'
|
|
30
|
+
export * from './useRouterState'
|
|
29
31
|
export * from './utils'
|
package/src/link.tsx
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import { useMatch } from './Matches'
|
|
3
|
-
import {
|
|
3
|
+
import { useRouterState } from './useRouterState'
|
|
4
|
+
import { useRouter } from './useRouter'
|
|
4
5
|
import { Trim } from './fileRoute'
|
|
5
6
|
import { AnyRoute, ReactNode, RootSearchSchema } from './route'
|
|
6
|
-
import {
|
|
7
|
-
RouteByPath,
|
|
8
|
-
RouteIds,
|
|
9
|
-
RoutePaths,
|
|
10
|
-
} from './routeInfo'
|
|
7
|
+
import { RouteByPath, RouteIds, RoutePaths } from './routeInfo'
|
|
11
8
|
import { RegisteredRouter } from './router'
|
|
12
9
|
import { LinkProps, UseLinkPropsOptions } from './useNavigate'
|
|
13
10
|
import {
|
|
@@ -188,7 +185,11 @@ export type ParamOptions<
|
|
|
188
185
|
RootSearchSchema
|
|
189
186
|
>
|
|
190
187
|
>,
|
|
191
|
-
TToIndex = TTo extends ''
|
|
188
|
+
TToIndex = TTo extends ''
|
|
189
|
+
? ''
|
|
190
|
+
: RouteByPath<TRouteTree, `${TTo}/`> extends never
|
|
191
|
+
? TTo
|
|
192
|
+
: `${TTo}/`,
|
|
192
193
|
TToParams = TToIndex extends ''
|
|
193
194
|
? TFromParams
|
|
194
195
|
: never extends TResolved
|
package/src/router.ts
CHANGED
|
@@ -18,7 +18,13 @@ import {
|
|
|
18
18
|
Route,
|
|
19
19
|
LoaderFnContext,
|
|
20
20
|
} from './route'
|
|
21
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
FullSearchSchema,
|
|
23
|
+
RouteById,
|
|
24
|
+
RoutePaths,
|
|
25
|
+
RoutesById,
|
|
26
|
+
RoutesByPath,
|
|
27
|
+
} from './routeInfo'
|
|
22
28
|
import { defaultParseSearch, defaultStringifySearch } from './searchParams'
|
|
23
29
|
import {
|
|
24
30
|
PickAsRequired,
|
|
@@ -33,14 +39,13 @@ import {
|
|
|
33
39
|
Timeout,
|
|
34
40
|
} from './utils'
|
|
35
41
|
import { RouteComponent } from './route'
|
|
36
|
-
import { AnyRouteMatch, RouteMatch } from './Matches'
|
|
42
|
+
import { AnyRouteMatch, MatchRouteOptions, RouteMatch } from './Matches'
|
|
37
43
|
import { ParsedLocation } from './location'
|
|
38
44
|
import { SearchSerializer, SearchParser } from './searchParams'
|
|
39
45
|
import {
|
|
40
46
|
BuildLocationFn,
|
|
41
47
|
CommitLocationOptions,
|
|
42
48
|
InjectedHtmlEntry,
|
|
43
|
-
MatchRouteFn,
|
|
44
49
|
NavigateFn,
|
|
45
50
|
getRouteMatch,
|
|
46
51
|
} from './RouterProvider'
|
|
@@ -58,7 +63,8 @@ import {
|
|
|
58
63
|
} from './path'
|
|
59
64
|
import invariant from 'tiny-invariant'
|
|
60
65
|
import { isRedirect } from './redirects'
|
|
61
|
-
import { ToOptions } from './link'
|
|
66
|
+
import { ResolveRelativePath, ToOptions } from './link'
|
|
67
|
+
import { NoInfer } from '@tanstack/react-store'
|
|
62
68
|
// import warning from 'tiny-warning'
|
|
63
69
|
|
|
64
70
|
//
|
|
@@ -1517,7 +1523,14 @@ export class Router<
|
|
|
1517
1523
|
return matches
|
|
1518
1524
|
}
|
|
1519
1525
|
|
|
1520
|
-
matchRoute
|
|
1526
|
+
matchRoute = <
|
|
1527
|
+
TFrom extends RoutePaths<TRouteTree> = '/',
|
|
1528
|
+
TTo extends string = '',
|
|
1529
|
+
TResolved = ResolveRelativePath<TFrom, NoInfer<TTo>>,
|
|
1530
|
+
>(
|
|
1531
|
+
location: ToOptions<TRouteTree, TFrom, TTo>,
|
|
1532
|
+
opts?: MatchRouteOptions,
|
|
1533
|
+
): false | RouteById<TRouteTree, TResolved>['types']['allParams'] => {
|
|
1521
1534
|
location = {
|
|
1522
1535
|
...location,
|
|
1523
1536
|
to: location.to
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { Router } from './router'
|
|
3
|
+
|
|
4
|
+
export let routerContext = React.createContext<Router<any>>(null!)
|
|
5
|
+
if (typeof document !== 'undefined') {
|
|
6
|
+
if (window.__TSR_ROUTER_CONTEXT__) {
|
|
7
|
+
routerContext = window.__TSR_ROUTER_CONTEXT__
|
|
8
|
+
} else {
|
|
9
|
+
window.__TSR_ROUTER_CONTEXT__ = routerContext as any
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -4,7 +4,7 @@ const useLayoutEffect =
|
|
|
4
4
|
typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect
|
|
5
5
|
|
|
6
6
|
import { ParsedLocation } from './location'
|
|
7
|
-
import { useRouter } from './
|
|
7
|
+
import { useRouter } from './useRouter'
|
|
8
8
|
import { NonNullableUpdater, functionalUpdate } from './utils'
|
|
9
9
|
|
|
10
10
|
const windowKey = 'window'
|
package/src/useBlocker.tsx
CHANGED
package/src/useNavigate.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import { useMatch } from './Matches'
|
|
3
|
-
import { useRouter } from './
|
|
3
|
+
import { useRouter } from './useRouter'
|
|
4
4
|
import { LinkOptions, NavigateOptions } from './link'
|
|
5
5
|
import { AnyRoute } from './route'
|
|
6
6
|
import { RoutePaths } from './routeInfo'
|
package/src/useParams.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import { AnyRoute } from './route'
|
|
|
2
2
|
import { RouteIds, RouteById } from './routeInfo'
|
|
3
3
|
import { RegisteredRouter } from './router'
|
|
4
4
|
import { last } from './utils'
|
|
5
|
-
import { useRouterState } from './
|
|
5
|
+
import { useRouterState } from './useRouterState'
|
|
6
6
|
import { StrictOrFrom } from './utils'
|
|
7
7
|
import { getRenderedMatches } from './Matches'
|
|
8
8
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useMatch, RouteMatch } from './Matches'
|
|
2
|
+
import { AnyRoute } from './route'
|
|
3
|
+
import { RouteIds, RouteById } from './routeInfo'
|
|
4
|
+
import { RegisteredRouter } from './router'
|
|
5
|
+
import { StrictOrFrom } from './utils'
|
|
6
|
+
|
|
7
|
+
export function useRouteContext<
|
|
8
|
+
TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
|
|
9
|
+
TFrom extends RouteIds<TRouteTree> = RouteIds<TRouteTree>,
|
|
10
|
+
TRouteContext = RouteById<TRouteTree, TFrom>['types']['allContext'],
|
|
11
|
+
TSelected = TRouteContext,
|
|
12
|
+
>(
|
|
13
|
+
opts: StrictOrFrom<TFrom> & {
|
|
14
|
+
select?: (search: TRouteContext) => TSelected
|
|
15
|
+
},
|
|
16
|
+
): TSelected {
|
|
17
|
+
return useMatch({
|
|
18
|
+
...(opts as any),
|
|
19
|
+
select: (match: RouteMatch) =>
|
|
20
|
+
opts?.select
|
|
21
|
+
? opts.select(match.context as TRouteContext)
|
|
22
|
+
: match.context,
|
|
23
|
+
})
|
|
24
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import warning from 'tiny-warning'
|
|
3
|
+
import { AnyRoute } from './route'
|
|
4
|
+
import { RegisteredRouter, Router } from './router'
|
|
5
|
+
import { routerContext } from './routerContext'
|
|
6
|
+
|
|
7
|
+
export function useRouter<
|
|
8
|
+
TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
|
|
9
|
+
>(opts?: { warn?: boolean }): Router<TRouteTree> {
|
|
10
|
+
const resolvedContext =
|
|
11
|
+
typeof document !== 'undefined'
|
|
12
|
+
? window.__TSR_ROUTER_CONTEXT__ || routerContext
|
|
13
|
+
: routerContext
|
|
14
|
+
const value = React.useContext(resolvedContext)
|
|
15
|
+
warning(
|
|
16
|
+
!((opts?.warn ?? true) && !value),
|
|
17
|
+
'useRouter must be used inside a <RouterProvider> component!',
|
|
18
|
+
)
|
|
19
|
+
return value as any
|
|
20
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useStore } from '@tanstack/react-store'
|
|
2
|
+
import { AnyRoute } from './route'
|
|
3
|
+
import { RegisteredRouter, Router, RouterState } from './router'
|
|
4
|
+
import { useRouter } from './useRouter'
|
|
5
|
+
|
|
6
|
+
export function useRouterState<
|
|
7
|
+
TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
|
|
8
|
+
TSelected = RouterState<TRouteTree>,
|
|
9
|
+
>(opts?: {
|
|
10
|
+
router?: Router<TRouteTree>
|
|
11
|
+
select: (state: RouterState<RegisteredRouter['routeTree']>) => TSelected
|
|
12
|
+
}): TSelected {
|
|
13
|
+
const contextRouter = useRouter<TRouteTree>({
|
|
14
|
+
warn: opts?.router === undefined,
|
|
15
|
+
})
|
|
16
|
+
return useStore((opts?.router || contextRouter).__store, opts?.select as any)
|
|
17
|
+
}
|
package/src/utils.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
|
-
import { useMatch } from './Matches'
|
|
3
|
-
import { RouteMatch } from './Matches'
|
|
4
|
-
import { AnyRoute } from './route'
|
|
5
|
-
import { RouteIds, RouteById } from './routeInfo'
|
|
6
|
-
import { RegisteredRouter } from './router'
|
|
7
2
|
|
|
8
3
|
export type NoInfer<T> = [T][T extends any ? 0 : never]
|
|
9
4
|
export type IsAny<T, Y, N = T> = 1 extends 0 & T ? Y : N
|
|
@@ -306,25 +301,6 @@ export type StrictOrFrom<TFrom> =
|
|
|
306
301
|
strict: false
|
|
307
302
|
}
|
|
308
303
|
|
|
309
|
-
export function useRouteContext<
|
|
310
|
-
TRouteTree extends AnyRoute = RegisteredRouter['routeTree'],
|
|
311
|
-
TFrom extends RouteIds<TRouteTree> = RouteIds<TRouteTree>,
|
|
312
|
-
TRouteContext = RouteById<TRouteTree, TFrom>['types']['allContext'],
|
|
313
|
-
TSelected = TRouteContext,
|
|
314
|
-
>(
|
|
315
|
-
opts: StrictOrFrom<TFrom> & {
|
|
316
|
-
select?: (search: TRouteContext) => TSelected
|
|
317
|
-
},
|
|
318
|
-
): TSelected {
|
|
319
|
-
return useMatch({
|
|
320
|
-
...(opts as any),
|
|
321
|
-
select: (match: RouteMatch) =>
|
|
322
|
-
opts?.select
|
|
323
|
-
? opts.select(match.context as TRouteContext)
|
|
324
|
-
: match.context,
|
|
325
|
-
})
|
|
326
|
-
}
|
|
327
|
-
|
|
328
304
|
export const useLayoutEffect =
|
|
329
305
|
typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect
|
|
330
306
|
|