react-router 7.5.3 → 7.6.0

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/dist/development/{chunk-AYJ5UCUI.mjs → chunk-D4RADZKF.mjs} +903 -139
  3. package/dist/development/dom-export.d.mts +2 -2
  4. package/dist/development/dom-export.d.ts +1 -2
  5. package/dist/development/dom-export.js +34 -6102
  6. package/dist/development/dom-export.mjs +6 -3
  7. package/dist/development/index.d.mts +33 -67
  8. package/dist/development/index.d.ts +1893 -197
  9. package/dist/development/index.js +905 -141
  10. package/dist/development/index.mjs +2 -2
  11. package/dist/development/lib/types/route-module.d.mts +1 -2
  12. package/dist/development/lib/types/route-module.d.ts +1 -2
  13. package/dist/development/lib/types/route-module.js +1 -1
  14. package/dist/development/lib/types/route-module.mjs +1 -1
  15. package/dist/{production/fog-of-war-BLArG-qZ.d.ts → development/lib-CCSAGgcP.d.mts} +57 -12
  16. package/dist/{production/route-data-C12CLHiN.d.mts → development/route-data-B9_30zbP.d.ts} +11 -1
  17. package/dist/development/{route-data-C12CLHiN.d.mts → route-data-C6QaL0wu.d.mts} +11 -1
  18. package/dist/production/{chunk-KKWFQRUV.mjs → chunk-CVXGOGHQ.mjs} +903 -139
  19. package/dist/production/dom-export.d.mts +2 -2
  20. package/dist/production/dom-export.d.ts +1 -2
  21. package/dist/production/dom-export.js +34 -6102
  22. package/dist/production/dom-export.mjs +6 -3
  23. package/dist/production/index.d.mts +33 -67
  24. package/dist/production/index.d.ts +1893 -197
  25. package/dist/production/index.js +905 -141
  26. package/dist/production/index.mjs +2 -2
  27. package/dist/production/lib/types/route-module.d.mts +1 -2
  28. package/dist/production/lib/types/route-module.d.ts +1 -2
  29. package/dist/production/lib/types/route-module.js +1 -1
  30. package/dist/production/lib/types/route-module.mjs +1 -1
  31. package/dist/{development/fog-of-war-BLArG-qZ.d.ts → production/lib-CCSAGgcP.d.mts} +57 -12
  32. package/dist/{development/route-data-C12CLHiN.d.ts → production/route-data-B9_30zbP.d.ts} +11 -1
  33. package/dist/production/{route-data-C12CLHiN.d.ts → route-data-C6QaL0wu.d.mts} +11 -1
  34. package/package.json +5 -3
  35. package/dist/development/data-CQbyyGzl.d.mts +0 -11
  36. package/dist/development/data-CQbyyGzl.d.ts +0 -11
  37. package/dist/development/fog-of-war-D2zsXvum.d.mts +0 -1691
  38. package/dist/production/data-CQbyyGzl.d.mts +0 -11
  39. package/dist/production/data-CQbyyGzl.d.ts +0 -11
  40. package/dist/production/fog-of-war-D2zsXvum.d.mts +0 -1691
@@ -1,29 +1,421 @@
1
- import { a as Router, b as RouteModules, D as DataStrategyFunction, c as RouteManifest, S as ServerRouteModule, M as MiddlewareEnabled, u as unstable_RouterContextProvider, L as LoaderFunctionArgs, A as ActionFunctionArgs, T as To, d as RelativeRoutingType, e as Location, f as Action, P as ParamParseKey, g as Path, h as PathPattern, i as PathMatch, N as NavigateOptions, j as Params$1, k as RouteObject, l as Navigation, m as RevalidationState, U as UIMatch, n as SerializeFrom, B as BlockerFunction, o as Blocker, p as StaticHandlerContext, q as StaticHandler, F as FutureConfig$1, C as CreateStaticHandlerOptions$1, I as InitialEntry, H as HydrationState, r as unstable_InitialContext, s as IndexRouteObject, t as LoaderFunction, v as ActionFunction, w as MetaFunction, x as LinksFunction, y as NonIndexRouteObject, E as Equal, z as RouterState, G as DataRouteObject, J as ClientLoaderFunction } from './route-data-C12CLHiN.js';
2
- export { aw as ClientActionFunction, ax as ClientActionFunctionArgs, ay as ClientLoaderFunctionArgs, ar as DataRouteMatch, Z as DataStrategyFunctionArgs, _ as DataStrategyMatch, $ as DataStrategyResult, a1 as ErrorResponse, Q as Fetcher, a2 as FormEncType, a3 as FormMethod, aG as Future, K as GetScrollPositionFunction, O as GetScrollRestorationKeyFunction, a4 as HTMLFormMethod, az as HeadersArgs, aA as HeadersFunction, aE as HtmlLinkDescriptor, ah as IDLE_BLOCKER, ag as IDLE_FETCHER, af as IDLE_NAVIGATION, a5 as LazyRouteFunction, aF as LinkDescriptor, aB as MetaArgs, aC as MetaDescriptor, V as NavigationStates, as as Navigator, aD as PageLinkDescriptor, at as PatchRoutesOnNavigationFunction, au as PatchRoutesOnNavigationFunctionArgs, a7 as PathParam, a8 as RedirectFunction, av as RouteMatch, Y as RouterFetchOptions, R as RouterInit, X as RouterNavigateOptions, W as RouterSubscriber, aa as ShouldRevalidateFunction, ab as ShouldRevalidateFunctionArgs, aM as UNSAFE_DataRouterContext, aN as UNSAFE_DataRouterStateContext, a0 as UNSAFE_DataWithResponseInit, aL as UNSAFE_ErrorResponseImpl, aO as UNSAFE_FetchersContext, aP as UNSAFE_LocationContext, aQ as UNSAFE_NavigationContext, aR as UNSAFE_RouteContext, aS as UNSAFE_ViewTransitionContext, aI as UNSAFE_createBrowserHistory, aK as UNSAFE_createRouter, aJ as UNSAFE_invariant, ad as createPath, ai as data, aj as generatePath, ak as isRouteErrorResponse, al as matchPath, am as matchRoutes, ae as parsePath, an as redirect, ao as redirectDocument, ap as replace, aq as resolvePath, a6 as unstable_MiddlewareFunction, a9 as unstable_RouterContext, aH as unstable_SerializesTo, ac as unstable_createContext } from './route-data-C12CLHiN.js';
3
- import { A as AssetsManifest, a as Route, F as FutureConfig, E as EntryContext, C as CriticalCss } from './fog-of-war-BLArG-qZ.js';
4
- export { g as Await, b as AwaitProps, T as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, w as FetcherFormProps, G as FetcherSubmitFunction, a7 as FetcherSubmitOptions, J as FetcherWithComponents, Y as Form, x as FormProps, U as HashRouter, H as HashRouterProps, s as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, V as Link, t as LinkProps, ae as Links, h as MemoryRouter, M as MemoryRouterOpts, c as MemoryRouterProps, ad as Meta, X as NavLink, u as NavLinkProps, v as NavLinkRenderProps, i as Navigate, N as NavigateProps, j as Outlet, O as OutletProps, a8 as ParamKeyValuePair, P as PathRouteProps, ag as PrefetchPageLinks, k as Route, d as RouteProps, l as Router, e as RouterProps, m as RouterProvider, R as RouterProviderProps, n as Routes, f as RoutesProps, af as Scripts, ah as ScriptsProps, Z as ScrollRestoration, S as ScrollRestorationProps, y as SetURLSearchParams, z as SubmitFunction, a9 as SubmitOptions, ab as SubmitTarget, ak as UNSAFE_FrameworkContext, an as UNSAFE_createClientRoutes, ao as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, al as UNSAFE_getPatchRoutesOnNavigationFunction, ai as UNSAFE_hydrationRouteProperties, aj as UNSAFE_mapRouteProperties, ap as UNSAFE_shouldHydrateRouteLoader, am as UNSAFE_useFogOFWarDiscovery, aq as UNSAFE_useScrollRestoration, aa as URLSearchParamsInit, K as createBrowserRouter, Q as createHashRouter, o as createMemoryRouter, p as createRoutesFromChildren, q as createRoutesFromElements, ac as createSearchParams, r as renderMatches, W as unstable_HistoryRouter, a5 as unstable_usePrompt, a4 as useBeforeUnload, a2 as useFetcher, a3 as useFetchers, a1 as useFormAction, _ as useLinkClickHandler, $ as useSearchParams, a0 as useSubmit, a6 as useViewTransitionState } from './fog-of-war-BLArG-qZ.js';
1
+ import { R as RouteObject, a as RouterInit, F as FutureConfig$1, H as HydrationState, I as InitialEntry, D as DataStrategyFunction, P as PatchRoutesOnNavigationFunction, b as Router$1, T as To, c as RelativeRoutingType, N as NonIndexRouteObject, L as LazyRouteFunction, d as IndexRouteObject, e as Location, A as Action, f as Navigator, g as RouteMatch, h as RouteManifest, S as ServerRouteModule, M as MiddlewareEnabled, u as unstable_RouterContextProvider, i as AppLoadContext, j as LoaderFunctionArgs, k as ActionFunctionArgs, l as StaticHandlerContext, m as RouteModules, n as DataRouteObject, C as ClientLoaderFunction, o as ParamParseKey, p as Path, q as PathPattern, r as PathMatch, s as NavigateOptions, t as Params$1, v as Navigation, U as UIMatch, w as SerializeFrom, B as BlockerFunction, x as Blocker, y as HTMLFormMethod, z as FormEncType, E as PageLinkDescriptor, G as History, J as GetScrollRestorationKeyFunction, K as Fetcher, O as StaticHandler, Q as CreateStaticHandlerOptions$1, V as unstable_InitialContext, W as LoaderFunction, X as ActionFunction, Y as MetaFunction, Z as LinksFunction, _ as Equal, $ as RouterState } from './route-data-B9_30zbP.js';
2
+ export { az as ClientActionFunction, aA as ClientActionFunctionArgs, aB as ClientLoaderFunctionArgs, ax as DataRouteMatch, a6 as DataStrategyFunctionArgs, a7 as DataStrategyMatch, a8 as DataStrategyResult, aa as ErrorResponse, ab as FormMethod, aI as Future, a0 as GetScrollPositionFunction, aC as HeadersArgs, aD as HeadersFunction, aG as HtmlLinkDescriptor, an as IDLE_BLOCKER, am as IDLE_FETCHER, al as IDLE_NAVIGATION, aH as LinkDescriptor, aE as MetaArgs, aF as MetaDescriptor, a1 as NavigationStates, ay as PatchRoutesOnNavigationFunctionArgs, ad as PathParam, ae as RedirectFunction, a5 as RevalidationState, a4 as RouterFetchOptions, a3 as RouterNavigateOptions, a2 as RouterSubscriber, ag as ShouldRevalidateFunction, ah as ShouldRevalidateFunctionArgs, aO as UNSAFE_DataRouterContext, aP as UNSAFE_DataRouterStateContext, a9 as UNSAFE_DataWithResponseInit, aN as UNSAFE_ErrorResponseImpl, aQ as UNSAFE_FetchersContext, aR as UNSAFE_LocationContext, aS as UNSAFE_NavigationContext, aT as UNSAFE_RouteContext, aU as UNSAFE_ViewTransitionContext, aK as UNSAFE_createBrowserHistory, aM as UNSAFE_createRouter, aL as UNSAFE_invariant, aj as createPath, ao as data, ap as generatePath, aq as isRouteErrorResponse, ar as matchPath, as as matchRoutes, ak as parsePath, at as redirect, au as redirectDocument, av as replace, aw as resolvePath, ac as unstable_MiddlewareFunction, af as unstable_RouterContext, aJ as unstable_SerializesTo, ai as unstable_createContext } from './route-data-B9_30zbP.js';
5
3
  import * as React from 'react';
6
4
  import { ReactElement } from 'react';
7
5
  import { ParseOptions, SerializeOptions } from 'cookie';
8
6
  export { ParseOptions as CookieParseOptions, SerializeOptions as CookieSerializeOptions } from 'cookie';
9
- import { A as AppLoadContext } from './data-CQbyyGzl.js';
10
7
 
11
- declare const SingleFetchRedirectSymbol: unique symbol;
12
- declare function getTurboStreamSingleFetchDataStrategy(getRouter: () => Router, manifest: AssetsManifest, routeModules: RouteModules, ssr: boolean, basename: string | undefined): DataStrategyFunction;
13
- declare function decodeViaTurboStream(body: ReadableStream<Uint8Array>, global: Window | typeof globalThis): Promise<{
14
- done: Promise<undefined>;
15
- value: unknown;
16
- }>;
8
+ /**
9
+ * @private
10
+ */
11
+ declare function mapRouteProperties(route: RouteObject): Partial<RouteObject> & {
12
+ hasErrorBoundary: boolean;
13
+ };
14
+ declare const hydrationRouteProperties: (keyof RouteObject)[];
15
+ interface MemoryRouterOpts {
16
+ /**
17
+ * Basename path for the application.
18
+ */
19
+ basename?: string;
20
+ /**
21
+ * Function to provide the initial context values for all client side navigations/fetches
22
+ */
23
+ unstable_getContext?: RouterInit["unstable_getContext"];
24
+ /**
25
+ * Future flags to enable for the router.
26
+ */
27
+ future?: Partial<FutureConfig$1>;
28
+ /**
29
+ * Hydration data to initialize the router with if you have already performed
30
+ * data loading on the server.
31
+ */
32
+ hydrationData?: HydrationState;
33
+ /**
34
+ * Initial entires in the in-memory history stack
35
+ */
36
+ initialEntries?: InitialEntry[];
37
+ /**
38
+ * Index of `initialEntries` the application should initialize to
39
+ */
40
+ initialIndex?: number;
41
+ /**
42
+ * Override the default data strategy of loading in parallel.
43
+ * Only intended for advanced usage.
44
+ */
45
+ dataStrategy?: DataStrategyFunction;
46
+ /**
47
+ * Lazily define portions of the route tree on navigations.
48
+ */
49
+ patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction;
50
+ }
51
+ /**
52
+ * Create a new data router that manages the application path using an in-memory
53
+ * history stack. Useful for non-browser environments without a DOM API.
54
+ *
55
+ * @category Data Routers
56
+ */
57
+ declare function createMemoryRouter(
58
+ /**
59
+ * Application routes
60
+ */
61
+ routes: RouteObject[],
62
+ /**
63
+ * Router options
64
+ */
65
+ opts?: MemoryRouterOpts): Router$1;
66
+ interface RouterProviderProps {
67
+ router: Router$1;
68
+ flushSync?: (fn: () => unknown) => undefined;
69
+ }
70
+ /**
71
+ * Given a Remix Router instance, render the appropriate UI
72
+ */
73
+ declare function RouterProvider({ router, flushSync: reactDomFlushSyncImpl, }: RouterProviderProps): React.ReactElement;
74
+ /**
75
+ * @category Types
76
+ */
77
+ interface MemoryRouterProps {
78
+ basename?: string;
79
+ children?: React.ReactNode;
80
+ initialEntries?: InitialEntry[];
81
+ initialIndex?: number;
82
+ }
83
+ /**
84
+ * A `<Router>` that stores all entries in memory.
85
+ *
86
+ * @category Component Routers
87
+ */
88
+ declare function MemoryRouter({ basename, children, initialEntries, initialIndex, }: MemoryRouterProps): React.ReactElement;
89
+ /**
90
+ * @category Types
91
+ */
92
+ interface NavigateProps {
93
+ to: To;
94
+ replace?: boolean;
95
+ state?: any;
96
+ relative?: RelativeRoutingType;
97
+ }
98
+ /**
99
+ * A component-based version of {@link useNavigate} to use in a [`React.Component
100
+ * Class`](https://reactjs.org/docs/react-component.html) where hooks are not
101
+ * able to be used.
102
+ *
103
+ * It's recommended to avoid using this component in favor of {@link useNavigate}
104
+ *
105
+ * @category Components
106
+ */
107
+ declare function Navigate({ to, replace, state, relative, }: NavigateProps): null;
108
+ /**
109
+ * @category Types
110
+ */
111
+ interface OutletProps {
112
+ /**
113
+ Provides a context value to the element tree below the outlet. Use when the parent route needs to provide values to child routes.
114
+
115
+ ```tsx
116
+ <Outlet context={myContextValue} />
117
+ ```
118
+
119
+ Access the context with {@link useOutletContext}.
120
+ */
121
+ context?: unknown;
122
+ }
123
+ /**
124
+ Renders the matching child route of a parent route or nothing if no child route matches.
125
+
126
+ ```tsx
127
+ import { Outlet } from "react-router"
128
+
129
+ export default function SomeParent() {
130
+ return (
131
+ <div>
132
+ <h1>Parent Content</h1>
133
+ <Outlet />
134
+ </div>
135
+ );
136
+ }
137
+ ```
17
138
 
139
+ @category Components
140
+ */
141
+ declare function Outlet(props: OutletProps): React.ReactElement | null;
18
142
  /**
19
- * The mode to use when running the server.
143
+ * @category Types
20
144
  */
21
- declare enum ServerMode {
22
- Development = "development",
23
- Production = "production",
24
- Test = "test"
145
+ interface PathRouteProps {
146
+ caseSensitive?: NonIndexRouteObject["caseSensitive"];
147
+ path?: NonIndexRouteObject["path"];
148
+ id?: NonIndexRouteObject["id"];
149
+ lazy?: LazyRouteFunction<NonIndexRouteObject>;
150
+ loader?: NonIndexRouteObject["loader"];
151
+ action?: NonIndexRouteObject["action"];
152
+ hasErrorBoundary?: NonIndexRouteObject["hasErrorBoundary"];
153
+ shouldRevalidate?: NonIndexRouteObject["shouldRevalidate"];
154
+ handle?: NonIndexRouteObject["handle"];
155
+ index?: false;
156
+ children?: React.ReactNode;
157
+ element?: React.ReactNode | null;
158
+ hydrateFallbackElement?: React.ReactNode | null;
159
+ errorElement?: React.ReactNode | null;
160
+ Component?: React.ComponentType | null;
161
+ HydrateFallback?: React.ComponentType | null;
162
+ ErrorBoundary?: React.ComponentType | null;
163
+ }
164
+ /**
165
+ * @category Types
166
+ */
167
+ interface LayoutRouteProps extends PathRouteProps {
168
+ }
169
+ /**
170
+ * @category Types
171
+ */
172
+ interface IndexRouteProps {
173
+ caseSensitive?: IndexRouteObject["caseSensitive"];
174
+ path?: IndexRouteObject["path"];
175
+ id?: IndexRouteObject["id"];
176
+ lazy?: LazyRouteFunction<IndexRouteObject>;
177
+ loader?: IndexRouteObject["loader"];
178
+ action?: IndexRouteObject["action"];
179
+ hasErrorBoundary?: IndexRouteObject["hasErrorBoundary"];
180
+ shouldRevalidate?: IndexRouteObject["shouldRevalidate"];
181
+ handle?: IndexRouteObject["handle"];
182
+ index: true;
183
+ children?: undefined;
184
+ element?: React.ReactNode | null;
185
+ hydrateFallbackElement?: React.ReactNode | null;
186
+ errorElement?: React.ReactNode | null;
187
+ Component?: React.ComponentType | null;
188
+ HydrateFallback?: React.ComponentType | null;
189
+ ErrorBoundary?: React.ComponentType | null;
190
+ }
191
+ type RouteProps = PathRouteProps | LayoutRouteProps | IndexRouteProps;
192
+ /**
193
+ * Configures an element to render when a pattern matches the current location.
194
+ * It must be rendered within a {@link Routes} element. Note that these routes
195
+ * do not participate in data loading, actions, code splitting, or any other
196
+ * route module features.
197
+ *
198
+ * @category Components
199
+ */
200
+ declare function Route$1(_props: RouteProps): React.ReactElement | null;
201
+ /**
202
+ * @category Types
203
+ */
204
+ interface RouterProps {
205
+ basename?: string;
206
+ children?: React.ReactNode;
207
+ location: Partial<Location> | string;
208
+ navigationType?: Action;
209
+ navigator: Navigator;
210
+ static?: boolean;
211
+ }
212
+ /**
213
+ * Provides location context for the rest of the app.
214
+ *
215
+ * Note: You usually won't render a `<Router>` directly. Instead, you'll render a
216
+ * router that is more specific to your environment such as a `<BrowserRouter>`
217
+ * in web browsers or a `<StaticRouter>` for server rendering.
218
+ *
219
+ * @category Components
220
+ */
221
+ declare function Router({ basename: basenameProp, children, location: locationProp, navigationType, navigator, static: staticProp, }: RouterProps): React.ReactElement | null;
222
+ /**
223
+ * @category Types
224
+ */
225
+ interface RoutesProps {
226
+ /**
227
+ * Nested {@link Route} elements
228
+ */
229
+ children?: React.ReactNode;
230
+ /**
231
+ * The location to match against. Defaults to the current location.
232
+ */
233
+ location?: Partial<Location> | string;
234
+ }
235
+ /**
236
+ Renders a branch of {@link Route | `<Routes>`} that best matches the current
237
+ location. Note that these routes do not participate in data loading, actions,
238
+ code splitting, or any other route module features.
239
+
240
+ ```tsx
241
+ import { Routes, Route } from "react-router"
242
+
243
+ <Routes>
244
+ <Route index element={<StepOne />} />
245
+ <Route path="step-2" element={<StepTwo />} />
246
+ <Route path="step-3" element={<StepThree />}>
247
+ </Routes>
248
+ ```
249
+
250
+ @category Components
251
+ */
252
+ declare function Routes({ children, location, }: RoutesProps): React.ReactElement | null;
253
+ interface AwaitResolveRenderFunction<Resolve = any> {
254
+ (data: Awaited<Resolve>): React.ReactNode;
255
+ }
256
+ /**
257
+ * @category Types
258
+ */
259
+ interface AwaitProps<Resolve> {
260
+ /**
261
+ When using a function, the resolved value is provided as the parameter.
262
+
263
+ ```tsx [2]
264
+ <Await resolve={reviewsPromise}>
265
+ {(resolvedReviews) => <Reviews items={resolvedReviews} />}
266
+ </Await>
267
+ ```
268
+
269
+ When using React elements, {@link useAsyncValue} will provide the
270
+ resolved value:
271
+
272
+ ```tsx [2]
273
+ <Await resolve={reviewsPromise}>
274
+ <Reviews />
275
+ </Await>
276
+
277
+ function Reviews() {
278
+ const resolvedReviews = useAsyncValue()
279
+ return <div>...</div>
280
+ }
281
+ ```
282
+ */
283
+ children: React.ReactNode | AwaitResolveRenderFunction<Resolve>;
284
+ /**
285
+ The error element renders instead of the children when the promise rejects.
286
+
287
+ ```tsx
288
+ <Await
289
+ errorElement={<div>Oops</div>}
290
+ resolve={reviewsPromise}
291
+ >
292
+ <Reviews />
293
+ </Await>
294
+ ```
295
+
296
+ To provide a more contextual error, you can use the {@link useAsyncError} in a
297
+ child component
298
+
299
+ ```tsx
300
+ <Await
301
+ errorElement={<ReviewsError />}
302
+ resolve={reviewsPromise}
303
+ >
304
+ <Reviews />
305
+ </Await>
306
+
307
+ function ReviewsError() {
308
+ const error = useAsyncError()
309
+ return <div>Error loading reviews: {error.message}</div>
310
+ }
311
+ ```
312
+
313
+ If you do not provide an errorElement, the rejected value will bubble up to
314
+ the nearest route-level {@link NonIndexRouteObject#ErrorBoundary | ErrorBoundary} and be accessible
315
+ via {@link useRouteError} hook.
316
+ */
317
+ errorElement?: React.ReactNode;
318
+ /**
319
+ Takes a promise returned from a {@link LoaderFunction | loader} value to be resolved and rendered.
320
+
321
+ ```jsx
322
+ import { useLoaderData, Await } from "react-router"
323
+
324
+ export async function loader() {
325
+ let reviews = getReviews() // not awaited
326
+ let book = await getBook()
327
+ return {
328
+ book,
329
+ reviews, // this is a promise
330
+ }
331
+ }
332
+
333
+ export default function Book() {
334
+ const {
335
+ book,
336
+ reviews, // this is the same promise
337
+ } = useLoaderData()
338
+
339
+ return (
340
+ <div>
341
+ <h1>{book.title}</h1>
342
+ <p>{book.description}</p>
343
+ <React.Suspense fallback={<ReviewsSkeleton />}>
344
+ <Await
345
+ // and is the promise we pass to Await
346
+ resolve={reviews}
347
+ >
348
+ <Reviews />
349
+ </Await>
350
+ </React.Suspense>
351
+ </div>
352
+ );
353
+ }
354
+ ```
355
+ */
356
+ resolve: Resolve;
357
+ }
358
+ /**
359
+ Used to render promise values with automatic error handling.
360
+
361
+ ```tsx
362
+ import { Await, useLoaderData } from "react-router";
363
+
364
+ export function loader() {
365
+ // not awaited
366
+ const reviews = getReviews()
367
+ // awaited (blocks the transition)
368
+ const book = await fetch("/api/book").then((res) => res.json())
369
+ return { book, reviews }
25
370
  }
26
371
 
372
+ function Book() {
373
+ const { book, reviews } = useLoaderData();
374
+ return (
375
+ <div>
376
+ <h1>{book.title}</h1>
377
+ <p>{book.description}</p>
378
+ <React.Suspense fallback={<ReviewsSkeleton />}>
379
+ <Await
380
+ resolve={reviews}
381
+ errorElement={
382
+ <div>Could not load reviews 😬</div>
383
+ }
384
+ children={(resolvedReviews) => (
385
+ <Reviews items={resolvedReviews} />
386
+ )}
387
+ />
388
+ </React.Suspense>
389
+ </div>
390
+ );
391
+ }
392
+ ```
393
+
394
+ **Note:** `<Await>` expects to be rendered inside of a `<React.Suspense>`
395
+
396
+ @category Components
397
+
398
+ */
399
+ declare function Await<Resolve>({ children, errorElement, resolve, }: AwaitProps<Resolve>): React.JSX.Element;
400
+ /**
401
+ * Creates a route config from a React "children" object, which is usually
402
+ * either a `<Route>` element or an array of them. Used internally by
403
+ * `<Routes>` to create a route config from its children.
404
+ *
405
+ * @category Utils
406
+ */
407
+ declare function createRoutesFromChildren(children: React.ReactNode, parentPath?: number[]): RouteObject[];
408
+ /**
409
+ * Create route objects from JSX elements instead of arrays of objects
410
+ */
411
+ declare let createRoutesFromElements: typeof createRoutesFromChildren;
412
+ /**
413
+ * Renders the result of `matchRoutes()` into a React element.
414
+ *
415
+ * @category Utils
416
+ */
417
+ declare function renderMatches(matches: RouteMatch[] | null): React.ReactElement | null;
418
+
27
419
  type ServerRouteManifest = RouteManifest<Omit<ServerRoute, "children">>;
28
420
  interface ServerRoute extends Route {
29
421
  children: ServerRoute[];
@@ -53,6 +445,10 @@ interface ServerBuild {
53
445
  */
54
446
  isSpaMode: boolean;
55
447
  prerender: string[];
448
+ routeDiscovery: {
449
+ mode: "lazy" | "initial";
450
+ manifestPath: string;
451
+ };
56
452
  }
57
453
  interface HandleDocumentRequestFunction {
58
454
  (request: Request, responseStatusCode: number, responseHeaders: Headers, context: EntryContext, loadContext: MiddlewareEnabled extends true ? unstable_RouterContextProvider : AppLoadContext): Promise<Response> | Response;
@@ -74,6 +470,101 @@ interface ServerEntryModule {
74
470
  streamTimeout?: number;
75
471
  }
76
472
 
473
+ type SerializedError = {
474
+ message: string;
475
+ stack?: string;
476
+ };
477
+ interface FrameworkContextObject {
478
+ manifest: AssetsManifest;
479
+ routeModules: RouteModules;
480
+ criticalCss?: CriticalCss;
481
+ serverHandoffString?: string;
482
+ future: FutureConfig;
483
+ ssr: boolean;
484
+ isSpaMode: boolean;
485
+ routeDiscovery: ServerBuild["routeDiscovery"];
486
+ serializeError?(error: Error): SerializedError;
487
+ renderMeta?: {
488
+ didRenderScripts?: boolean;
489
+ streamCache?: Record<number, Promise<void> & {
490
+ result?: {
491
+ done: boolean;
492
+ value: string;
493
+ };
494
+ error?: unknown;
495
+ }>;
496
+ };
497
+ }
498
+ interface EntryContext extends FrameworkContextObject {
499
+ staticHandlerContext: StaticHandlerContext;
500
+ serverHandoffStream?: ReadableStream<Uint8Array>;
501
+ }
502
+ interface FutureConfig {
503
+ unstable_subResourceIntegrity: boolean;
504
+ unstable_middleware: boolean;
505
+ }
506
+ type CriticalCss = string | {
507
+ rel: "stylesheet";
508
+ href: string;
509
+ };
510
+ interface AssetsManifest {
511
+ entry: {
512
+ imports: string[];
513
+ module: string;
514
+ };
515
+ routes: RouteManifest<EntryRoute>;
516
+ url: string;
517
+ version: string;
518
+ hmr?: {
519
+ timestamp?: number;
520
+ runtime: string;
521
+ };
522
+ sri?: Record<string, string> | true;
523
+ }
524
+
525
+ interface Route {
526
+ index?: boolean;
527
+ caseSensitive?: boolean;
528
+ id: string;
529
+ parentId?: string;
530
+ path?: string;
531
+ }
532
+ interface EntryRoute extends Route {
533
+ hasAction: boolean;
534
+ hasLoader: boolean;
535
+ hasClientAction: boolean;
536
+ hasClientLoader: boolean;
537
+ hasClientMiddleware: boolean;
538
+ hasErrorBoundary: boolean;
539
+ imports?: string[];
540
+ css?: string[];
541
+ module: string;
542
+ clientActionModule: string | undefined;
543
+ clientLoaderModule: string | undefined;
544
+ clientMiddlewareModule: string | undefined;
545
+ hydrateFallbackModule: string | undefined;
546
+ parentId?: string;
547
+ }
548
+ declare function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation: Set<string>, manifest: RouteManifest<EntryRoute>, routeModulesCache: RouteModules, initialState: HydrationState, ssr: boolean, isSpaMode: boolean): DataRouteObject[];
549
+ declare function createClientRoutes(manifest: RouteManifest<EntryRoute>, routeModulesCache: RouteModules, initialState: HydrationState | null, ssr: boolean, isSpaMode: boolean, parentId?: string, routesByParentId?: Record<string, Omit<EntryRoute, "children">[]>, needsRevalidation?: Set<string>): DataRouteObject[];
550
+ declare function shouldHydrateRouteLoader(routeId: string, clientLoader: ClientLoaderFunction | undefined, hasLoader: boolean, isSpaMode: boolean): boolean;
551
+
552
+ declare const SingleFetchRedirectSymbol: unique symbol;
553
+ declare function getTurboStreamSingleFetchDataStrategy(getRouter: () => Router$1, manifest: AssetsManifest, routeModules: RouteModules, ssr: boolean, basename: string | undefined): DataStrategyFunction;
554
+ declare function decodeViaTurboStream(body: ReadableStream<Uint8Array>, global: Window | typeof globalThis): Promise<{
555
+ done: Promise<undefined>;
556
+ value: unknown;
557
+ }>;
558
+
559
+ /**
560
+ * The mode to use when running the server.
561
+ */
562
+ declare enum ServerMode {
563
+ Development = "development",
564
+ Production = "production",
565
+ Test = "test"
566
+ }
567
+
77
568
  /**
78
569
  Resolves a URL against the current location.
79
570
 
@@ -181,265 +672,1453 @@ declare function useOutletContext<Context = unknown>(): Context;
181
672
  */
182
673
  declare function useOutlet(context?: unknown): React.ReactElement | null;
183
674
  /**
184
- Returns an object of key/value pairs of the dynamic params from the current URL that were matched by the routes. Child routes inherit all params from their parent routes.
675
+ Returns an object of key/value pairs of the dynamic params from the current URL that were matched by the routes. Child routes inherit all params from their parent routes.
676
+
677
+ ```tsx
678
+ import { useParams } from "react-router"
679
+
680
+ function SomeComponent() {
681
+ let params = useParams()
682
+ params.postId
683
+ }
684
+ ```
685
+
686
+ Assuming a route pattern like `/posts/:postId` is matched by `/posts/123` then `params.postId` will be `"123"`.
687
+
688
+ @category Hooks
689
+ */
690
+ declare function useParams<ParamsOrKey extends string | Record<string, string | undefined> = string>(): Readonly<[
691
+ ParamsOrKey
692
+ ] extends [string] ? Params$1<ParamsOrKey> : Partial<ParamsOrKey>>;
693
+ /**
694
+ Resolves the pathname of the given `to` value against the current location. Similar to {@link useHref}, but returns a {@link Path} instead of a string.
695
+
696
+ ```tsx
697
+ import { useResolvedPath } from "react-router"
698
+
699
+ function SomeComponent() {
700
+ // if the user is at /dashboard/profile
701
+ let path = useResolvedPath("../accounts")
702
+ path.pathname // "/dashboard/accounts"
703
+ path.search // ""
704
+ path.hash // ""
705
+ }
706
+ ```
707
+
708
+ @category Hooks
709
+ */
710
+ declare function useResolvedPath(to: To, { relative }?: {
711
+ relative?: RelativeRoutingType;
712
+ }): Path;
713
+ /**
714
+ Hook version of {@link Routes | `<Routes>`} that uses objects instead of components. These objects have the same properties as the component props.
715
+
716
+ The return value of `useRoutes` is either a valid React element you can use to render the route tree, or `null` if nothing matched.
717
+
718
+ ```tsx
719
+ import * as React from "react";
720
+ import { useRoutes } from "react-router";
721
+
722
+ function App() {
723
+ let element = useRoutes([
724
+ {
725
+ path: "/",
726
+ element: <Dashboard />,
727
+ children: [
728
+ {
729
+ path: "messages",
730
+ element: <DashboardMessages />,
731
+ },
732
+ { path: "tasks", element: <DashboardTasks /> },
733
+ ],
734
+ },
735
+ { path: "team", element: <AboutPage /> },
736
+ ]);
737
+
738
+ return element;
739
+ }
740
+ ```
741
+
742
+ @category Hooks
743
+ */
744
+ declare function useRoutes(routes: RouteObject[], locationArg?: Partial<Location> | string): React.ReactElement | null;
745
+ /**
746
+ Returns the current navigation, defaulting to an "idle" navigation when no navigation is in progress. You can use this to render pending UI (like a global spinner) or read FormData from a form navigation.
747
+
748
+ ```tsx
749
+ import { useNavigation } from "react-router"
750
+
751
+ function SomeComponent() {
752
+ let navigation = useNavigation();
753
+ navigation.state
754
+ navigation.formData
755
+ // etc.
756
+ }
757
+ ```
758
+
759
+ @category Hooks
760
+ */
761
+ declare function useNavigation(): Navigation;
762
+ /**
763
+ Revalidate the data on the page for reasons outside of normal data mutations like window focus or polling on an interval.
764
+
765
+ ```tsx
766
+ import { useRevalidator } from "react-router";
767
+
768
+ function WindowFocusRevalidator() {
769
+ const revalidator = useRevalidator();
770
+
771
+ useFakeWindowFocus(() => {
772
+ revalidator.revalidate();
773
+ });
774
+
775
+ return (
776
+ <div hidden={revalidator.state === "idle"}>
777
+ Revalidating...
778
+ </div>
779
+ );
780
+ }
781
+ ```
782
+
783
+ Note that page data is already revalidated automatically after actions. If you find yourself using this for normal CRUD operations on your data in response to user interactions, you're probably not taking advantage of the other APIs like {@link useFetcher}, {@link Form}, {@link useSubmit} that do this automatically.
784
+
785
+ @category Hooks
786
+ */
787
+ declare function useRevalidator(): {
788
+ revalidate: () => Promise<void>;
789
+ state: Router$1["state"]["revalidation"];
790
+ };
791
+ /**
792
+ * Returns the active route matches, useful for accessing loaderData for
793
+ * parent/child routes or the route "handle" property
794
+ *
795
+ * @category Hooks
796
+ */
797
+ declare function useMatches(): UIMatch[];
798
+ /**
799
+ Returns the data from the closest route {@link LoaderFunction | loader} or {@link ClientLoaderFunction | client loader}.
800
+
801
+ ```tsx
802
+ import { useLoaderData } from "react-router"
803
+
804
+ export async function loader() {
805
+ return await fakeDb.invoices.findAll();
806
+ }
807
+
808
+ export default function Invoices() {
809
+ let invoices = useLoaderData<typeof loader>();
810
+ // ...
811
+ }
812
+ ```
813
+
814
+ @category Hooks
815
+ */
816
+ declare function useLoaderData<T = any>(): SerializeFrom<T>;
817
+ /**
818
+ Returns the loader data for a given route by route ID.
819
+
820
+ ```tsx
821
+ import { useRouteLoaderData } from "react-router";
822
+
823
+ function SomeComponent() {
824
+ const { user } = useRouteLoaderData("root");
825
+ }
826
+ ```
827
+
828
+ Route IDs are created automatically. They are simply the path of the route file relative to the app folder without the extension.
829
+
830
+ | Route Filename | Route ID |
831
+ | -------------------------- | -------------------- |
832
+ | `app/root.tsx` | `"root"` |
833
+ | `app/routes/teams.tsx` | `"routes/teams"` |
834
+ | `app/whatever/teams.$id.tsx` | `"whatever/teams.$id"` |
835
+
836
+ If you created an ID manually, you can use that instead:
837
+
838
+ ```tsx
839
+ route("/", "containers/app.tsx", { id: "app" }})
840
+ ```
841
+
842
+ @category Hooks
843
+ */
844
+ declare function useRouteLoaderData<T = any>(routeId: string): SerializeFrom<T> | undefined;
845
+ /**
846
+ Returns the action data from the most recent POST navigation form submission or `undefined` if there hasn't been one.
847
+
848
+ ```tsx
849
+ import { Form, useActionData } from "react-router"
850
+
851
+ export async function action({ request }) {
852
+ const body = await request.formData()
853
+ const name = body.get("visitorsName")
854
+ return { message: `Hello, ${name}` }
855
+ }
856
+
857
+ export default function Invoices() {
858
+ const data = useActionData()
859
+ return (
860
+ <Form method="post">
861
+ <input type="text" name="visitorsName" />
862
+ {data ? data.message : "Waiting..."}
863
+ </Form>
864
+ )
865
+ }
866
+ ```
867
+
868
+ @category Hooks
869
+ */
870
+ declare function useActionData<T = any>(): SerializeFrom<T> | undefined;
871
+ /**
872
+ Accesses the error thrown during an {@link ActionFunction | action}, {@link LoaderFunction | loader}, or component render to be used in a route module Error Boundary.
873
+
874
+ ```tsx
875
+ export function ErrorBoundary() {
876
+ const error = useRouteError();
877
+ return <div>{error.message}</div>;
878
+ }
879
+ ```
880
+
881
+ @category Hooks
882
+ */
883
+ declare function useRouteError(): unknown;
884
+ /**
885
+ Returns the resolved promise value from the closest {@link Await | `<Await>`}.
886
+
887
+ ```tsx
888
+ function SomeDescendant() {
889
+ const value = useAsyncValue();
890
+ // ...
891
+ }
892
+
893
+ // somewhere in your app
894
+ <Await resolve={somePromise}>
895
+ <SomeDescendant />
896
+ </Await>
897
+ ```
898
+
899
+ @category Hooks
900
+ */
901
+ declare function useAsyncValue(): unknown;
902
+ /**
903
+ Returns the rejection value from the closest {@link Await | `<Await>`}.
904
+
905
+ ```tsx
906
+ import { Await, useAsyncError } from "react-router"
907
+
908
+ function ErrorElement() {
909
+ const error = useAsyncError();
910
+ return (
911
+ <p>Uh Oh, something went wrong! {error.message}</p>
912
+ );
913
+ }
914
+
915
+ // somewhere in your app
916
+ <Await
917
+ resolve={promiseThatRejects}
918
+ errorElement={<ErrorElement />}
919
+ />
920
+ ```
921
+
922
+ @category Hooks
923
+ */
924
+ declare function useAsyncError(): unknown;
925
+ /**
926
+ * Allow the application to block navigations within the SPA and present the
927
+ * user a confirmation dialog to confirm the navigation. Mostly used to avoid
928
+ * using half-filled form data. This does not handle hard-reloads or
929
+ * cross-origin navigations.
930
+ *
931
+ * @category Hooks
932
+ */
933
+ declare function useBlocker(shouldBlock: boolean | BlockerFunction): Blocker;
934
+
935
+ type ParamKeyValuePair = [string, string];
936
+ type URLSearchParamsInit = string | ParamKeyValuePair[] | Record<string, string | string[]> | URLSearchParams;
937
+ /**
938
+ Creates a URLSearchParams object using the given initializer.
939
+
940
+ This is identical to `new URLSearchParams(init)` except it also
941
+ supports arrays as values in the object form of the initializer
942
+ instead of just strings. This is convenient when you need multiple
943
+ values for a given key, but don't want to use an array initializer.
944
+
945
+ For example, instead of:
946
+
947
+ ```tsx
948
+ let searchParams = new URLSearchParams([
949
+ ['sort', 'name'],
950
+ ['sort', 'price']
951
+ ]);
952
+ ```
953
+ you can do:
954
+
955
+ ```
956
+ let searchParams = createSearchParams({
957
+ sort: ['name', 'price']
958
+ });
959
+ ```
960
+
961
+ @category Utils
962
+ */
963
+ declare function createSearchParams(init?: URLSearchParamsInit): URLSearchParams;
964
+ type JsonObject = {
965
+ [Key in string]: JsonValue;
966
+ } & {
967
+ [Key in string]?: JsonValue | undefined;
968
+ };
969
+ type JsonArray = JsonValue[] | readonly JsonValue[];
970
+ type JsonPrimitive = string | number | boolean | null;
971
+ type JsonValue = JsonPrimitive | JsonObject | JsonArray;
972
+ type SubmitTarget = HTMLFormElement | HTMLButtonElement | HTMLInputElement | FormData | URLSearchParams | JsonValue | null;
973
+ /**
974
+ * Submit options shared by both navigations and fetchers
975
+ */
976
+ interface SharedSubmitOptions {
977
+ /**
978
+ * The HTTP method used to submit the form. Overrides `<form method>`.
979
+ * Defaults to "GET".
980
+ */
981
+ method?: HTMLFormMethod;
982
+ /**
983
+ * The action URL path used to submit the form. Overrides `<form action>`.
984
+ * Defaults to the path of the current route.
985
+ */
986
+ action?: string;
987
+ /**
988
+ * The encoding used to submit the form. Overrides `<form encType>`.
989
+ * Defaults to "application/x-www-form-urlencoded".
990
+ */
991
+ encType?: FormEncType;
992
+ /**
993
+ * Determines whether the form action is relative to the route hierarchy or
994
+ * the pathname. Use this if you want to opt out of navigating the route
995
+ * hierarchy and want to instead route based on /-delimited URL segments
996
+ */
997
+ relative?: RelativeRoutingType;
998
+ /**
999
+ * In browser-based environments, prevent resetting scroll after this
1000
+ * navigation when using the <ScrollRestoration> component
1001
+ */
1002
+ preventScrollReset?: boolean;
1003
+ /**
1004
+ * Enable flushSync for this submission's state updates
1005
+ */
1006
+ flushSync?: boolean;
1007
+ }
1008
+ /**
1009
+ * Submit options available to fetchers
1010
+ */
1011
+ interface FetcherSubmitOptions extends SharedSubmitOptions {
1012
+ }
1013
+ /**
1014
+ * Submit options available to navigations
1015
+ */
1016
+ interface SubmitOptions extends FetcherSubmitOptions {
1017
+ /**
1018
+ * Set `true` to replace the current entry in the browser's history stack
1019
+ * instead of creating a new one (i.e. stay on "the same page"). Defaults
1020
+ * to `false`.
1021
+ */
1022
+ replace?: boolean;
1023
+ /**
1024
+ * State object to add to the history stack entry for this navigation
1025
+ */
1026
+ state?: any;
1027
+ /**
1028
+ * Indicate a specific fetcherKey to use when using navigate=false
1029
+ */
1030
+ fetcherKey?: string;
1031
+ /**
1032
+ * navigate=false will use a fetcher instead of a navigation
1033
+ */
1034
+ navigate?: boolean;
1035
+ /**
1036
+ * Enable view transitions on this submission navigation
1037
+ */
1038
+ viewTransition?: boolean;
1039
+ }
1040
+
1041
+ declare const FrameworkContext: React.Context<FrameworkContextObject | undefined>;
1042
+ /**
1043
+ * Defines the discovery behavior of the link:
1044
+ *
1045
+ * - "render" - default, discover the route when the link renders
1046
+ * - "none" - don't eagerly discover, only discover if the link is clicked
1047
+ */
1048
+ type DiscoverBehavior = "render" | "none";
1049
+ /**
1050
+ * Defines the prefetching behavior of the link:
1051
+ *
1052
+ * - "none": Never fetched
1053
+ * - "intent": Fetched when the user focuses or hovers the link
1054
+ * - "render": Fetched when the link is rendered
1055
+ * - "viewport": Fetched when the link is in the viewport
1056
+ */
1057
+ type PrefetchBehavior = "intent" | "render" | "none" | "viewport";
1058
+ /**
1059
+ Renders all of the `<link>` tags created by route module {@link LinksFunction} export. You should render it inside the `<head>` of your document.
1060
+
1061
+ ```tsx
1062
+ import { Links } from "react-router";
1063
+
1064
+ export default function Root() {
1065
+ return (
1066
+ <html>
1067
+ <head>
1068
+ <Links />
1069
+ </head>
1070
+ <body></body>
1071
+ </html>
1072
+ );
1073
+ }
1074
+ ```
1075
+
1076
+ @category Components
1077
+ */
1078
+ declare function Links(): React.JSX.Element;
1079
+ /**
1080
+ Renders `<link rel=prefetch|modulepreload>` tags for modules and data of another page to enable an instant navigation to that page. {@link LinkProps.prefetch | `<Link prefetch>`} uses this internally, but you can render it to prefetch a page for any other reason.
1081
+
1082
+ ```tsx
1083
+ import { PrefetchPageLinks } from "react-router"
1084
+
1085
+ <PrefetchPageLinks page="/absolute/path" />
1086
+ ```
1087
+
1088
+ For example, you may render one of this as the user types into a search field to prefetch search results before they click through to their selection.
1089
+
1090
+ @category Components
1091
+ */
1092
+ declare function PrefetchPageLinks({ page, ...dataLinkProps }: PageLinkDescriptor): React.JSX.Element | null;
1093
+ /**
1094
+ Renders all the `<meta>` tags created by route module {@link MetaFunction} exports. You should render it inside the `<head>` of your HTML.
1095
+
1096
+ ```tsx
1097
+ import { Meta } from "react-router";
1098
+
1099
+ export default function Root() {
1100
+ return (
1101
+ <html>
1102
+ <head>
1103
+ <Meta />
1104
+ </head>
1105
+ </html>
1106
+ );
1107
+ }
1108
+ ```
1109
+
1110
+ @category Components
1111
+ */
1112
+ declare function Meta(): React.JSX.Element;
1113
+ /**
1114
+ A couple common attributes:
1115
+
1116
+ - `<Scripts crossOrigin>` for hosting your static assets on a different server than your app.
1117
+ - `<Scripts nonce>` to support a [content security policy for scripts](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src) with [nonce-sources](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/Sources#sources) for your `<script>` tags.
1118
+
1119
+ You cannot pass through attributes such as `async`, `defer`, `src`, `type`, `noModule` because they are managed by React Router internally.
1120
+
1121
+ @category Types
1122
+ */
1123
+ type ScriptsProps = Omit<React.HTMLProps<HTMLScriptElement>, "children" | "async" | "defer" | "src" | "type" | "noModule" | "dangerouslySetInnerHTML" | "suppressHydrationWarning">;
1124
+ /**
1125
+ Renders the client runtime of your app. It should be rendered inside the `<body>` of the document.
1126
+
1127
+ ```tsx
1128
+ import { Scripts } from "react-router";
1129
+
1130
+ export default function Root() {
1131
+ return (
1132
+ <html>
1133
+ <head />
1134
+ <body>
1135
+ <Scripts />
1136
+ </body>
1137
+ </html>
1138
+ );
1139
+ }
1140
+ ```
1141
+
1142
+ If server rendering, you can omit `<Scripts/>` and the app will work as a traditional web app without JavaScript, relying solely on HTML and browser behaviors.
1143
+
1144
+ @category Components
1145
+ */
1146
+ declare function Scripts(props: ScriptsProps): React.JSX.Element | null;
1147
+
1148
+ declare global {
1149
+ const REACT_ROUTER_VERSION: string;
1150
+ }
1151
+ /**
1152
+ * @category Routers
1153
+ */
1154
+ interface DOMRouterOpts {
1155
+ /**
1156
+ * Basename path for the application.
1157
+ */
1158
+ basename?: string;
1159
+ /**
1160
+ * Function to provide the initial context values for all client side navigations/fetches
1161
+ */
1162
+ unstable_getContext?: RouterInit["unstable_getContext"];
1163
+ /**
1164
+ * Future flags to enable for the router.
1165
+ */
1166
+ future?: Partial<FutureConfig$1>;
1167
+ /**
1168
+ * Hydration data to initialize the router with if you have already performed
1169
+ * data loading on the server.
1170
+ */
1171
+ hydrationData?: HydrationState;
1172
+ /**
1173
+ * Override the default data strategy of loading in parallel.
1174
+ * Only intended for advanced usage.
1175
+ */
1176
+ dataStrategy?: DataStrategyFunction;
1177
+ /**
1178
+ * Lazily define portions of the route tree on navigations.
1179
+ */
1180
+ patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction;
1181
+ /**
1182
+ * Window object override - defaults to the global `window` instance.
1183
+ */
1184
+ window?: Window;
1185
+ }
1186
+ /**
1187
+ * Create a new data router that manages the application path via `history.pushState`
1188
+ * and `history.replaceState`.
1189
+ *
1190
+ * @category Data Routers
1191
+ */
1192
+ declare function createBrowserRouter(
1193
+ /**
1194
+ * Application routes
1195
+ */
1196
+ routes: RouteObject[],
1197
+ /**
1198
+ * Router options
1199
+ */
1200
+ opts?: DOMRouterOpts): Router$1;
1201
+ /**
1202
+ * Create a new data router that manages the application path via the URL hash
1203
+ *
1204
+ * @category Data Routers
1205
+ */
1206
+ declare function createHashRouter(routes: RouteObject[], opts?: DOMRouterOpts): Router$1;
1207
+ /**
1208
+ * @category Types
1209
+ */
1210
+ interface BrowserRouterProps {
1211
+ basename?: string;
1212
+ children?: React.ReactNode;
1213
+ window?: Window;
1214
+ }
1215
+ /**
1216
+ * A `<Router>` for use in web browsers. Provides the cleanest URLs.
1217
+ *
1218
+ * @category Component Routers
1219
+ */
1220
+ declare function BrowserRouter({ basename, children, window, }: BrowserRouterProps): React.JSX.Element;
1221
+ /**
1222
+ * @category Types
1223
+ */
1224
+ interface HashRouterProps {
1225
+ basename?: string;
1226
+ children?: React.ReactNode;
1227
+ window?: Window;
1228
+ }
1229
+ /**
1230
+ * A `<Router>` for use in web browsers. Stores the location in the hash
1231
+ * portion of the URL so it is not sent to the server.
1232
+ *
1233
+ * @category Component Routers
1234
+ */
1235
+ declare function HashRouter({ basename, children, window }: HashRouterProps): React.JSX.Element;
1236
+ /**
1237
+ * @category Types
1238
+ */
1239
+ interface HistoryRouterProps {
1240
+ basename?: string;
1241
+ children?: React.ReactNode;
1242
+ history: History;
1243
+ }
1244
+ /**
1245
+ * A `<Router>` that accepts a pre-instantiated history object. It's important
1246
+ * to note that using your own history object is highly discouraged and may add
1247
+ * two versions of the history library to your bundles unless you use the same
1248
+ * version of the history library that React Router uses internally.
1249
+ *
1250
+ * @name unstable_HistoryRouter
1251
+ * @category Component Routers
1252
+ */
1253
+ declare function HistoryRouter({ basename, children, history, }: HistoryRouterProps): React.JSX.Element;
1254
+ declare namespace HistoryRouter {
1255
+ var displayName: string;
1256
+ }
1257
+ /**
1258
+ * @category Types
1259
+ */
1260
+ interface LinkProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href"> {
1261
+ /**
1262
+ Defines the link discovery behavior
1263
+
1264
+ ```tsx
1265
+ <Link /> // default ("render")
1266
+ <Link discover="render" />
1267
+ <Link discover="none" />
1268
+ ```
1269
+
1270
+ - **render** - default, discover the route when the link renders
1271
+ - **none** - don't eagerly discover, only discover if the link is clicked
1272
+ */
1273
+ discover?: DiscoverBehavior;
1274
+ /**
1275
+ Defines the data and module prefetching behavior for the link.
1276
+
1277
+ ```tsx
1278
+ <Link /> // default
1279
+ <Link prefetch="none" />
1280
+ <Link prefetch="intent" />
1281
+ <Link prefetch="render" />
1282
+ <Link prefetch="viewport" />
1283
+ ```
1284
+
1285
+ - **none** - default, no prefetching
1286
+ - **intent** - prefetches when the user hovers or focuses the link
1287
+ - **render** - prefetches when the link renders
1288
+ - **viewport** - prefetches when the link is in the viewport, very useful for mobile
1289
+
1290
+ Prefetching is done with HTML `<link rel="prefetch">` tags. They are inserted after the link.
1291
+
1292
+ ```tsx
1293
+ <a href="..." />
1294
+ <a href="..." />
1295
+ <link rel="prefetch" /> // might conditionally render
1296
+ ```
1297
+
1298
+ Because of this, if you are using `nav :last-child` you will need to use `nav :last-of-type` so the styles don't conditionally fall off your last link (and any other similar selectors).
1299
+ */
1300
+ prefetch?: PrefetchBehavior;
1301
+ /**
1302
+ Will use document navigation instead of client side routing when the link is clicked: the browser will handle the transition normally (as if it were an `<a href>`).
1303
+
1304
+ ```tsx
1305
+ <Link to="/logout" reloadDocument />
1306
+ ```
1307
+ */
1308
+ reloadDocument?: boolean;
1309
+ /**
1310
+ Replaces the current entry in the history stack instead of pushing a new one onto it.
1311
+
1312
+ ```tsx
1313
+ <Link replace />
1314
+ ```
1315
+
1316
+ ```
1317
+ # with a history stack like this
1318
+ A -> B
1319
+
1320
+ # normal link click pushes a new entry
1321
+ A -> B -> C
1322
+
1323
+ # but with `replace`, B is replaced by C
1324
+ A -> C
1325
+ ```
1326
+ */
1327
+ replace?: boolean;
1328
+ /**
1329
+ Adds persistent client side routing state to the next location.
1330
+
1331
+ ```tsx
1332
+ <Link to="/somewhere/else" state={{ some: "value" }} />
1333
+ ```
1334
+
1335
+ The location state is accessed from the `location`.
1336
+
1337
+ ```tsx
1338
+ function SomeComp() {
1339
+ const location = useLocation()
1340
+ location.state; // { some: "value" }
1341
+ }
1342
+ ```
1343
+
1344
+ This state is inaccessible on the server as it is implemented on top of [`history.state`](https://developer.mozilla.org/en-US/docs/Web/API/History/state)
1345
+ */
1346
+ state?: any;
1347
+ /**
1348
+ Prevents the scroll position from being reset to the top of the window when the link is clicked and the app is using {@link ScrollRestoration}. This only prevents new locations reseting scroll to the top, scroll position will be restored for back/forward button navigation.
1349
+
1350
+ ```tsx
1351
+ <Link to="?tab=one" preventScrollReset />
1352
+ ```
1353
+ */
1354
+ preventScrollReset?: boolean;
1355
+ /**
1356
+ Defines the relative path behavior for the link.
1357
+
1358
+ ```tsx
1359
+ <Link to=".." /> // default: "route"
1360
+ <Link relative="route" />
1361
+ <Link relative="path" />
1362
+ ```
1363
+
1364
+ Consider a route hierarchy where a parent route pattern is "blog" and a child route pattern is "blog/:slug/edit".
1365
+
1366
+ - **route** - default, resolves the link relative to the route pattern. In the example above a relative link of `".."` will remove both `:slug/edit` segments back to "/blog".
1367
+ - **path** - relative to the path so `..` will only remove one URL segment up to "/blog/:slug"
1368
+ */
1369
+ relative?: RelativeRoutingType;
1370
+ /**
1371
+ Can be a string or a partial {@link Path}:
1372
+
1373
+ ```tsx
1374
+ <Link to="/some/path" />
1375
+
1376
+ <Link
1377
+ to={{
1378
+ pathname: "/some/path",
1379
+ search: "?query=string",
1380
+ hash: "#hash",
1381
+ }}
1382
+ />
1383
+ ```
1384
+ */
1385
+ to: To;
1386
+ /**
1387
+ Enables a [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API) for this navigation.
1388
+
1389
+ ```jsx
1390
+ <Link to={to} viewTransition>
1391
+ Click me
1392
+ </Link>
1393
+ ```
1394
+
1395
+ To apply specific styles for the transition, see {@link useViewTransitionState}
1396
+ */
1397
+ viewTransition?: boolean;
1398
+ }
1399
+ /**
1400
+ A progressively enhanced `<a href>` wrapper to enable navigation with client-side routing.
1401
+
1402
+ ```tsx
1403
+ import { Link } from "react-router";
1404
+
1405
+ <Link to="/dashboard">Dashboard</Link>;
1406
+
1407
+ <Link
1408
+ to={{
1409
+ pathname: "/some/path",
1410
+ search: "?query=string",
1411
+ hash: "#hash",
1412
+ }}
1413
+ />
1414
+ ```
1415
+
1416
+ @category Components
1417
+ */
1418
+ declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
1419
+ /**
1420
+ The object passed to {@link NavLink} `children`, `className`, and `style` prop callbacks to render and style the link based on its state.
1421
+
1422
+ ```
1423
+ // className
1424
+ <NavLink
1425
+ to="/messages"
1426
+ className={({ isActive, isPending }) =>
1427
+ isPending ? "pending" : isActive ? "active" : ""
1428
+ }
1429
+ >
1430
+ Messages
1431
+ </NavLink>
1432
+
1433
+ // style
1434
+ <NavLink
1435
+ to="/messages"
1436
+ style={({ isActive, isPending }) => {
1437
+ return {
1438
+ fontWeight: isActive ? "bold" : "",
1439
+ color: isPending ? "red" : "black",
1440
+ }
1441
+ )}
1442
+ />
1443
+
1444
+ // children
1445
+ <NavLink to="/tasks">
1446
+ {({ isActive, isPending }) => (
1447
+ <span className={isActive ? "active" : ""}>Tasks</span>
1448
+ )}
1449
+ </NavLink>
1450
+ ```
1451
+
1452
+ */
1453
+ type NavLinkRenderProps = {
1454
+ /**
1455
+ * Indicates if the link's URL matches the current location.
1456
+ */
1457
+ isActive: boolean;
1458
+ /**
1459
+ * Indicates if the pending location matches the link's URL.
1460
+ */
1461
+ isPending: boolean;
1462
+ /**
1463
+ * Indicates if a view transition to the link's URL is in progress. See {@link useViewTransitionState}
1464
+ */
1465
+ isTransitioning: boolean;
1466
+ };
1467
+ /**
1468
+ * @category Types
1469
+ */
1470
+ interface NavLinkProps extends Omit<LinkProps, "className" | "style" | "children"> {
1471
+ /**
1472
+ Can be regular React children or a function that receives an object with the active and pending states of the link.
1473
+
1474
+ ```tsx
1475
+ <NavLink to="/tasks">
1476
+ {({ isActive }) => (
1477
+ <span className={isActive ? "active" : ""}>Tasks</span>
1478
+ )}
1479
+ </NavLink>
1480
+ ```
1481
+ */
1482
+ children?: React.ReactNode | ((props: NavLinkRenderProps) => React.ReactNode);
1483
+ /**
1484
+ Changes the matching logic to make it case-sensitive:
1485
+
1486
+ | Link | URL | isActive |
1487
+ | -------------------------------------------- | ------------- | -------- |
1488
+ | `<NavLink to="/SpOnGe-bOB" />` | `/sponge-bob` | true |
1489
+ | `<NavLink to="/SpOnGe-bOB" caseSensitive />` | `/sponge-bob` | false |
1490
+ */
1491
+ caseSensitive?: boolean;
1492
+ /**
1493
+ Classes are automatically applied to NavLink that correspond to {@link NavLinkRenderProps}.
1494
+
1495
+ ```css
1496
+ a.active { color: red; }
1497
+ a.pending { color: blue; }
1498
+ a.transitioning {
1499
+ view-transition-name: my-transition;
1500
+ }
1501
+ ```
1502
+ */
1503
+ className?: string | ((props: NavLinkRenderProps) => string | undefined);
1504
+ /**
1505
+ Changes the matching logic for the `active` and `pending` states to only match to the "end" of the {@link NavLinkProps.to}. If the URL is longer, it will no longer be considered active.
1506
+
1507
+ | Link | URL | isActive |
1508
+ | ----------------------------- | ------------ | -------- |
1509
+ | `<NavLink to="/tasks" />` | `/tasks` | true |
1510
+ | `<NavLink to="/tasks" />` | `/tasks/123` | true |
1511
+ | `<NavLink to="/tasks" end />` | `/tasks` | true |
1512
+ | `<NavLink to="/tasks" end />` | `/tasks/123` | false |
1513
+
1514
+ `<NavLink to="/">` is an exceptional case because _every_ URL matches `/`. To avoid this matching every single route by default, it effectively ignores the `end` prop and only matches when you're at the root route.
1515
+ */
1516
+ end?: boolean;
1517
+ style?: React.CSSProperties | ((props: NavLinkRenderProps) => React.CSSProperties | undefined);
1518
+ }
1519
+ /**
1520
+ Wraps {@link Link | `<Link>`} with additional props for styling active and pending states.
1521
+
1522
+ - Automatically applies classes to the link based on its active and pending states, see {@link NavLinkProps.className}.
1523
+ - Automatically applies `aria-current="page"` to the link when the link is active. See [`aria-current`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current) on MDN.
1524
+
1525
+ ```tsx
1526
+ import { NavLink } from "react-router"
1527
+ <NavLink to="/message" />
1528
+ ```
1529
+
1530
+ States are available through the className, style, and children render props. See {@link NavLinkRenderProps}.
1531
+
1532
+ ```tsx
1533
+ <NavLink
1534
+ to="/messages"
1535
+ className={({ isActive, isPending }) =>
1536
+ isPending ? "pending" : isActive ? "active" : ""
1537
+ }
1538
+ >
1539
+ Messages
1540
+ </NavLink>
1541
+ ```
1542
+
1543
+ @category Components
1544
+ */
1545
+ declare const NavLink: React.ForwardRefExoticComponent<NavLinkProps & React.RefAttributes<HTMLAnchorElement>>;
1546
+ /**
1547
+ * Form props shared by navigations and fetchers
1548
+ */
1549
+ interface SharedFormProps extends React.FormHTMLAttributes<HTMLFormElement> {
1550
+ /**
1551
+ * The HTTP verb to use when the form is submitted. Supports "get", "post",
1552
+ * "put", "delete", and "patch".
1553
+ *
1554
+ * Native `<form>` only supports `get` and `post`, avoid the other verbs if
1555
+ * you'd like to support progressive enhancement
1556
+ */
1557
+ method?: HTMLFormMethod;
1558
+ /**
1559
+ * The encoding type to use for the form submission.
1560
+ */
1561
+ encType?: "application/x-www-form-urlencoded" | "multipart/form-data" | "text/plain";
1562
+ /**
1563
+ * The URL to submit the form data to. If `undefined`, this defaults to the closest route in context.
1564
+ */
1565
+ action?: string;
1566
+ /**
1567
+ * Determines whether the form action is relative to the route hierarchy or
1568
+ * the pathname. Use this if you want to opt out of navigating the route
1569
+ * hierarchy and want to instead route based on /-delimited URL segments
1570
+ */
1571
+ relative?: RelativeRoutingType;
1572
+ /**
1573
+ * Prevent the scroll position from resetting to the top of the viewport on
1574
+ * completion of the navigation when using the <ScrollRestoration> component
1575
+ */
1576
+ preventScrollReset?: boolean;
1577
+ /**
1578
+ * A function to call when the form is submitted. If you call
1579
+ * `event.preventDefault()` then this form will not do anything.
1580
+ */
1581
+ onSubmit?: React.FormEventHandler<HTMLFormElement>;
1582
+ }
1583
+ /**
1584
+ * Form props available to fetchers
1585
+ * @category Types
1586
+ */
1587
+ interface FetcherFormProps extends SharedFormProps {
1588
+ }
1589
+ /**
1590
+ * Form props available to navigations
1591
+ * @category Types
1592
+ */
1593
+ interface FormProps extends SharedFormProps {
1594
+ discover?: DiscoverBehavior;
1595
+ /**
1596
+ * Indicates a specific fetcherKey to use when using `navigate={false}` so you
1597
+ * can pick up the fetcher's state in a different component in a {@link
1598
+ * useFetcher}.
1599
+ */
1600
+ fetcherKey?: string;
1601
+ /**
1602
+ * Skips the navigation and uses a {@link useFetcher | fetcher} internally
1603
+ * when `false`. This is essentially a shorthand for `useFetcher()` +
1604
+ * `<fetcher.Form>` where you don't care about the resulting data in this
1605
+ * component.
1606
+ */
1607
+ navigate?: boolean;
1608
+ /**
1609
+ * Forces a full document navigation instead of client side routing + data
1610
+ * fetch.
1611
+ */
1612
+ reloadDocument?: boolean;
1613
+ /**
1614
+ * Replaces the current entry in the browser history stack when the form
1615
+ * navigates. Use this if you don't want the user to be able to click "back"
1616
+ * to the page with the form on it.
1617
+ */
1618
+ replace?: boolean;
1619
+ /**
1620
+ * State object to add to the history stack entry for this navigation
1621
+ */
1622
+ state?: any;
1623
+ /**
1624
+ * Enables a [View
1625
+ * Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API)
1626
+ * for this navigation. To apply specific styles during the transition see
1627
+ * {@link useViewTransitionState}.
1628
+ */
1629
+ viewTransition?: boolean;
1630
+ }
1631
+ /**
1632
+
1633
+ A progressively enhanced HTML [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form) that submits data to actions via `fetch`, activating pending states in `useNavigation` which enables advanced user interfaces beyond a basic HTML form. After a form's action completes, all data on the page is automatically revalidated to keep the UI in sync with the data.
1634
+
1635
+ Because it uses the HTML form API, server rendered pages are interactive at a basic level before JavaScript loads. Instead of React Router managing the submission, the browser manages the submission as well as the pending states (like the spinning favicon). After JavaScript loads, React Router takes over enabling web application user experiences.
1636
+
1637
+ Form is most useful for submissions that should also change the URL or otherwise add an entry to the browser history stack. For forms that shouldn't manipulate the browser history stack, use [`<fetcher.Form>`][fetcher_form].
1638
+
1639
+ ```tsx
1640
+ import { Form } from "react-router";
1641
+
1642
+ function NewEvent() {
1643
+ return (
1644
+ <Form action="/events" method="post">
1645
+ <input name="title" type="text" />
1646
+ <input name="description" type="text" />
1647
+ </Form>
1648
+ )
1649
+ }
1650
+ ```
1651
+
1652
+ @category Components
1653
+ */
1654
+ declare const Form: React.ForwardRefExoticComponent<FormProps & React.RefAttributes<HTMLFormElement>>;
1655
+ type ScrollRestorationProps = ScriptsProps & {
1656
+ /**
1657
+ Defines the key used to restore scroll positions.
1658
+
1659
+ ```tsx
1660
+ <ScrollRestoration
1661
+ getKey={(location, matches) => {
1662
+ // default behavior
1663
+ return location.key
1664
+ }}
1665
+ />
1666
+ ```
1667
+ */
1668
+ getKey?: GetScrollRestorationKeyFunction;
1669
+ storageKey?: string;
1670
+ };
1671
+ /**
1672
+ Emulates the browser's scroll restoration on location changes. Apps should only render one of these, right before the {@link Scripts} component.
185
1673
 
186
1674
  ```tsx
187
- import { useParams } from "react-router"
1675
+ import { ScrollRestoration } from "react-router";
188
1676
 
189
- function SomeComponent() {
190
- let params = useParams()
191
- params.postId
1677
+ export default function Root() {
1678
+ return (
1679
+ <html>
1680
+ <body>
1681
+ <ScrollRestoration />
1682
+ <Scripts />
1683
+ </body>
1684
+ </html>
1685
+ );
192
1686
  }
193
1687
  ```
194
1688
 
195
- Assuming a route pattern like `/posts/:postId` is matched by `/posts/123` then `params.postId` will be `"123"`.
196
-
197
- @category Hooks
198
- */
199
- declare function useParams<ParamsOrKey extends string | Record<string, string | undefined> = string>(): Readonly<[
200
- ParamsOrKey
201
- ] extends [string] ? Params$1<ParamsOrKey> : Partial<ParamsOrKey>>;
202
- /**
203
- Resolves the pathname of the given `to` value against the current location. Similar to {@link useHref}, but returns a {@link Path} instead of a string.
1689
+ This component renders an inline `<script>` to prevent scroll flashing. The `nonce` prop will be passed down to the script tag to allow CSP nonce usage.
204
1690
 
205
1691
  ```tsx
206
- import { useResolvedPath } from "react-router"
207
-
208
- function SomeComponent() {
209
- // if the user is at /dashboard/profile
210
- let path = useResolvedPath("../accounts")
211
- path.pathname // "/dashboard/accounts"
212
- path.search // ""
213
- path.hash // ""
214
- }
1692
+ <ScrollRestoration nonce={cspNonce} />
215
1693
  ```
216
1694
 
217
- @category Hooks
1695
+ @category Components
218
1696
  */
219
- declare function useResolvedPath(to: To, { relative }?: {
1697
+ declare function ScrollRestoration({ getKey, storageKey, ...props }: ScrollRestorationProps): React.JSX.Element | null;
1698
+ declare namespace ScrollRestoration {
1699
+ var displayName: string;
1700
+ }
1701
+ /**
1702
+ * Handles the click behavior for router `<Link>` components. This is useful if
1703
+ * you need to create custom `<Link>` components with the same click behavior we
1704
+ * use in our exported `<Link>`.
1705
+ *
1706
+ * @category Hooks
1707
+ */
1708
+ declare function useLinkClickHandler<E extends Element = HTMLAnchorElement>(to: To, { target, replace: replaceProp, state, preventScrollReset, relative, viewTransition, }?: {
1709
+ target?: React.HTMLAttributeAnchorTarget;
1710
+ replace?: boolean;
1711
+ state?: any;
1712
+ preventScrollReset?: boolean;
220
1713
  relative?: RelativeRoutingType;
221
- }): Path;
1714
+ viewTransition?: boolean;
1715
+ }): (event: React.MouseEvent<E, MouseEvent>) => void;
222
1716
  /**
223
- Hook version of {@link Routes | `<Routes>`} that uses objects instead of components. These objects have the same properties as the component props.
224
-
225
- The return value of `useRoutes` is either a valid React element you can use to render the route tree, or `null` if nothing matched.
1717
+ Returns a tuple of the current URL's {@link URLSearchParams} and a function to update them. Setting the search params causes a navigation.
226
1718
 
227
1719
  ```tsx
228
- import * as React from "react";
229
- import { useRoutes } from "react-router";
230
-
231
- function App() {
232
- let element = useRoutes([
233
- {
234
- path: "/",
235
- element: <Dashboard />,
236
- children: [
237
- {
238
- path: "messages",
239
- element: <DashboardMessages />,
240
- },
241
- { path: "tasks", element: <DashboardTasks /> },
242
- ],
243
- },
244
- { path: "team", element: <AboutPage /> },
245
- ]);
1720
+ import { useSearchParams } from "react-router";
246
1721
 
247
- return element;
1722
+ export function SomeComponent() {
1723
+ const [searchParams, setSearchParams] = useSearchParams();
1724
+ // ...
248
1725
  }
249
1726
  ```
250
1727
 
251
1728
  @category Hooks
252
1729
  */
253
- declare function useRoutes(routes: RouteObject[], locationArg?: Partial<Location> | string): React.ReactElement | null;
1730
+ declare function useSearchParams(defaultInit?: URLSearchParamsInit): [URLSearchParams, SetURLSearchParams];
254
1731
  /**
255
- Returns the current navigation, defaulting to an "idle" navigation when no navigation is in progress. You can use this to render pending UI (like a global spinner) or read FormData from a form navigation.
1732
+ Sets new search params and causes a navigation when called.
256
1733
 
257
1734
  ```tsx
258
- import { useNavigation } from "react-router"
259
-
260
- function SomeComponent() {
261
- let navigation = useNavigation();
262
- navigation.state
263
- navigation.formData
264
- // etc.
265
- }
1735
+ <button
1736
+ onClick={() => {
1737
+ const params = new URLSearchParams();
1738
+ params.set("someKey", "someValue");
1739
+ setSearchParams(params, {
1740
+ preventScrollReset: true,
1741
+ });
1742
+ }}
1743
+ />
266
1744
  ```
267
1745
 
268
- @category Hooks
1746
+ It also supports a function for setting new search params.
1747
+
1748
+ ```tsx
1749
+ <button
1750
+ onClick={() => {
1751
+ setSearchParams((prev) => {
1752
+ prev.set("someKey", "someValue");
1753
+ return prev;
1754
+ });
1755
+ }}
1756
+ />
1757
+ ```
269
1758
  */
270
- declare function useNavigation(): Navigation;
1759
+ type SetURLSearchParams = (nextInit?: URLSearchParamsInit | ((prev: URLSearchParams) => URLSearchParamsInit), navigateOpts?: NavigateOptions) => void;
271
1760
  /**
272
- Revalidate the data on the page for reasons outside of normal data mutations like window focus or polling on an interval.
1761
+ * Submits a HTML `<form>` to the server without reloading the page.
1762
+ */
1763
+ interface SubmitFunction {
1764
+ (
1765
+ /**
1766
+ Can be multiple types of elements and objects
273
1767
 
274
- ```tsx
275
- import { useRevalidator } from "react-router";
1768
+ **`HTMLFormElement`**
276
1769
 
277
- function WindowFocusRevalidator() {
278
- const revalidator = useRevalidator();
1770
+ ```tsx
1771
+ <Form
1772
+ onSubmit={(event) => {
1773
+ submit(event.currentTarget);
1774
+ }}
1775
+ />
1776
+ ```
279
1777
 
280
- useFakeWindowFocus(() => {
281
- revalidator.revalidate();
282
- });
1778
+ **`FormData`**
283
1779
 
284
- return (
285
- <div hidden={revalidator.state === "idle"}>
286
- Revalidating...
287
- </div>
288
- );
289
- }
290
- ```
1780
+ ```tsx
1781
+ const formData = new FormData();
1782
+ formData.append("myKey", "myValue");
1783
+ submit(formData, { method: "post" });
1784
+ ```
291
1785
 
292
- Note that page data is already revalidated automatically after actions. If you find yourself using this for normal CRUD operations on your data in response to user interactions, you're probably not taking advantage of the other APIs like {@link useFetcher}, {@link Form}, {@link useSubmit} that do this automatically.
1786
+ **Plain object that will be serialized as `FormData`**
293
1787
 
294
- @category Hooks
295
- */
296
- declare function useRevalidator(): {
297
- revalidate(): Promise<void>;
298
- state: RevalidationState;
299
- };
1788
+ ```tsx
1789
+ submit({ myKey: "myValue" }, { method: "post" });
1790
+ ```
1791
+
1792
+ **Plain object that will be serialized as JSON**
1793
+
1794
+ ```tsx
1795
+ submit(
1796
+ { myKey: "myValue" },
1797
+ { method: "post", encType: "application/json" }
1798
+ );
1799
+ ```
1800
+ */
1801
+ target: SubmitTarget,
1802
+ /**
1803
+ * Options that override the `<form>`'s own attributes. Required when
1804
+ * submitting arbitrary data without a backing `<form>`.
1805
+ */
1806
+ options?: SubmitOptions): Promise<void>;
1807
+ }
300
1808
  /**
301
- * Returns the active route matches, useful for accessing loaderData for
302
- * parent/child routes or the route "handle" property
303
- *
304
- * @category Hooks
1809
+ * Submits a fetcher `<form>` to the server without reloading the page.
305
1810
  */
306
- declare function useMatches(): UIMatch[];
307
- /**
308
- Returns the data from the closest route {@link LoaderFunction | loader} or {@link ClientLoaderFunction | client loader}.
1811
+ interface FetcherSubmitFunction {
1812
+ (
1813
+ /**
1814
+ Can be multiple types of elements and objects
309
1815
 
310
- ```tsx
311
- import { useLoaderData } from "react-router"
1816
+ **`HTMLFormElement`**
312
1817
 
313
- export async function loader() {
314
- return await fakeDb.invoices.findAll();
315
- }
1818
+ ```tsx
1819
+ <fetcher.Form
1820
+ onSubmit={(event) => {
1821
+ fetcher.submit(event.currentTarget);
1822
+ }}
1823
+ />
1824
+ ```
316
1825
 
317
- export default function Invoices() {
318
- let invoices = useLoaderData<typeof loader>();
319
- // ...
320
- }
321
- ```
1826
+ **`FormData`**
322
1827
 
323
- @category Hooks
324
- */
325
- declare function useLoaderData<T = any>(): SerializeFrom<T>;
326
- /**
327
- Returns the loader data for a given route by route ID.
1828
+ ```tsx
1829
+ const formData = new FormData();
1830
+ formData.append("myKey", "myValue");
1831
+ fetcher.submit(formData, { method: "post" });
1832
+ ```
328
1833
 
329
- ```tsx
330
- import { useRouteLoaderData } from "react-router";
1834
+ **Plain object that will be serialized as `FormData`**
331
1835
 
332
- function SomeComponent() {
333
- const { user } = useRouteLoaderData("root");
334
- }
335
- ```
1836
+ ```tsx
1837
+ fetcher.submit({ myKey: "myValue" }, { method: "post" });
1838
+ ```
336
1839
 
337
- Route IDs are created automatically. They are simply the path of the route file relative to the app folder without the extension.
1840
+ **Plain object that will be serialized as JSON**
338
1841
 
339
- | Route Filename | Route ID |
340
- | -------------------------- | -------------------- |
341
- | `app/root.tsx` | `"root"` |
342
- | `app/routes/teams.tsx` | `"routes/teams"` |
343
- | `app/whatever/teams.$id.tsx` | `"whatever/teams.$id"` |
1842
+ ```tsx
1843
+ fetcher.submit(
1844
+ { myKey: "myValue" },
1845
+ { method: "post", encType: "application/json" }
1846
+ );
1847
+ ```
344
1848
 
345
- If you created an ID manually, you can use that instead:
1849
+ */
1850
+ target: SubmitTarget, options?: FetcherSubmitOptions): Promise<void>;
1851
+ }
1852
+ /**
1853
+ The imperative version of {@link Form | `<Form>`} that lets you submit a form from code instead of a user interaction.
346
1854
 
347
1855
  ```tsx
348
- route("/", "containers/app.tsx", { id: "app" }})
1856
+ import { useSubmit } from "react-router";
1857
+
1858
+ function SomeComponent() {
1859
+ const submit = useSubmit();
1860
+ return (
1861
+ <Form
1862
+ onChange={(event) => {
1863
+ submit(event.currentTarget);
1864
+ }}
1865
+ />
1866
+ );
1867
+ }
349
1868
  ```
350
1869
 
351
1870
  @category Hooks
352
1871
  */
353
- declare function useRouteLoaderData<T = any>(routeId: string): SerializeFrom<T> | undefined;
1872
+ declare function useSubmit(): SubmitFunction;
354
1873
  /**
355
- Returns the action data from the most recent POST navigation form submission or `undefined` if there hasn't been one.
1874
+ Resolves the URL to the closest route in the component hierarchy instead of the current URL of the app.
1875
+
1876
+ This is used internally by {@link Form} resolve the action to the closest route, but can be used generically as well.
356
1877
 
357
1878
  ```tsx
358
- import { Form, useActionData } from "react-router"
1879
+ import { useFormAction } from "react-router";
359
1880
 
360
- export async function action({ request }) {
361
- const body = await request.formData()
362
- const name = body.get("visitorsName")
363
- return { message: `Hello, ${name}` }
364
- }
1881
+ function SomeComponent() {
1882
+ // closest route URL
1883
+ let action = useFormAction();
365
1884
 
366
- export default function Invoices() {
367
- const data = useActionData()
368
- return (
369
- <Form method="post">
370
- <input type="text" name="visitorsName" />
371
- {data ? data.message : "Waiting..."}
372
- </Form>
373
- )
1885
+ // closest route URL + "destroy"
1886
+ let destroyAction = useFormAction("destroy");
374
1887
  }
375
1888
  ```
376
1889
 
377
1890
  @category Hooks
378
1891
  */
379
- declare function useActionData<T = any>(): SerializeFrom<T> | undefined;
1892
+ declare function useFormAction(
380
1893
  /**
381
- Accesses the error thrown during an {@link ActionFunction | action}, {@link LoaderFunction | loader}, or component render to be used in a route module Error Boundary.
1894
+ * The action to append to the closest route URL.
1895
+ */
1896
+ action?: string, { relative }?: {
1897
+ relative?: RelativeRoutingType;
1898
+ }): string;
1899
+ /**
1900
+ The return value of `useFetcher` that keeps track of the state of a fetcher.
1901
+
1902
+ ```tsx
1903
+ let fetcher = useFetcher();
1904
+ ```
1905
+ */
1906
+ type FetcherWithComponents<TData> = Fetcher<TData> & {
1907
+ /**
1908
+ Just like {@link Form} except it doesn't cause a navigation.
1909
+
1910
+ ```tsx
1911
+ function SomeComponent() {
1912
+ const fetcher = useFetcher()
1913
+ return (
1914
+ <fetcher.Form method="post" action="/some/route">
1915
+ <input type="text" />
1916
+ </fetcher.Form>
1917
+ )
1918
+ }
1919
+ ```
1920
+ */
1921
+ Form: React.ForwardRefExoticComponent<FetcherFormProps & React.RefAttributes<HTMLFormElement>>;
1922
+ /**
1923
+ Submits form data to a route. While multiple nested routes can match a URL, only the leaf route will be called.
1924
+
1925
+ The `formData` can be multiple types:
1926
+
1927
+ - [`FormData`][form_data] - A `FormData` instance.
1928
+ - [`HTMLFormElement`][html_form_element] - A [`<form>`][form_element] DOM element.
1929
+ - `Object` - An object of key/value pairs that will be converted to a `FormData` instance by default. You can pass a more complex object and serialize it as JSON by specifying `encType: "application/json"`. See [`useSubmit`][use-submit] for more details.
1930
+
1931
+ If the method is `GET`, then the route [`loader`][loader] is being called and with the `formData` serialized to the url as [`URLSearchParams`][url_search_params]. If `DELETE`, `PATCH`, `POST`, or `PUT`, then the route [`action`][action] is being called with `formData` as the body.
1932
+
1933
+ ```tsx
1934
+ // Submit a FormData instance (GET request)
1935
+ const formData = new FormData();
1936
+ fetcher.submit(formData);
1937
+
1938
+ // Submit the HTML form element
1939
+ fetcher.submit(event.currentTarget.form, {
1940
+ method: "POST",
1941
+ });
1942
+
1943
+ // Submit key/value JSON as a FormData instance
1944
+ fetcher.submit(
1945
+ { serialized: "values" },
1946
+ { method: "POST" }
1947
+ );
1948
+
1949
+ // Submit raw JSON
1950
+ fetcher.submit(
1951
+ {
1952
+ deeply: {
1953
+ nested: {
1954
+ json: "values",
1955
+ },
1956
+ },
1957
+ },
1958
+ {
1959
+ method: "POST",
1960
+ encType: "application/json",
1961
+ }
1962
+ );
1963
+ ```
1964
+ */
1965
+ submit: FetcherSubmitFunction;
1966
+ /**
1967
+ Loads data from a route. Useful for loading data imperatively inside of user events outside of a normal button or form, like a combobox or search input.
1968
+
1969
+ ```tsx
1970
+ let fetcher = useFetcher()
1971
+
1972
+ <input onChange={e => {
1973
+ fetcher.load(`/search?q=${e.target.value}`)
1974
+ }} />
1975
+ ```
1976
+ */
1977
+ load: (href: string, opts?: {
1978
+ /**
1979
+ * Wraps the initial state update for this `fetcher.load` in a
1980
+ * `ReactDOM.flushSync` call instead of the default `React.startTransition`.
1981
+ * This allows you to perform synchronous DOM actions immediately after the
1982
+ * update is flushed to the DOM.
1983
+ */
1984
+ flushSync?: boolean;
1985
+ }) => Promise<void>;
1986
+ };
1987
+ /**
1988
+ Useful for creating complex, dynamic user interfaces that require multiple, concurrent data interactions without causing a navigation.
1989
+
1990
+ Fetchers track their own, independent state and can be used to load data, submit forms, and generally interact with loaders and actions.
382
1991
 
383
1992
  ```tsx
384
- export function ErrorBoundary() {
385
- const error = useRouteError();
386
- return <div>{error.message}</div>;
1993
+ import { useFetcher } from "react-router"
1994
+
1995
+ function SomeComponent() {
1996
+ let fetcher = useFetcher()
1997
+
1998
+ // states are available on the fetcher
1999
+ fetcher.state // "idle" | "loading" | "submitting"
2000
+ fetcher.data // the data returned from the action or loader
2001
+
2002
+ // render a form
2003
+ <fetcher.Form method="post" />
2004
+
2005
+ // load data
2006
+ fetcher.load("/some/route")
2007
+
2008
+ // submit data
2009
+ fetcher.submit(someFormRef, { method: "post" })
2010
+ fetcher.submit(someData, {
2011
+ method: "post",
2012
+ encType: "application/json"
2013
+ })
387
2014
  }
388
2015
  ```
389
2016
 
390
2017
  @category Hooks
391
2018
  */
392
- declare function useRouteError(): unknown;
2019
+ declare function useFetcher<T = any>({ key, }?: {
2020
+ /**
2021
+ By default, `useFetcher` generate a unique fetcher scoped to that component. If you want to identify a fetcher with your own key such that you can access it from elsewhere in your app, you can do that with the `key` option:
2022
+
2023
+ ```tsx
2024
+ function SomeComp() {
2025
+ let fetcher = useFetcher({ key: "my-key" })
2026
+ // ...
2027
+ }
2028
+
2029
+ // Somewhere else
2030
+ function AnotherComp() {
2031
+ // this will be the same fetcher, sharing the state across the app
2032
+ let fetcher = useFetcher({ key: "my-key" });
2033
+ // ...
2034
+ }
2035
+ ```
2036
+ */
2037
+ key?: string;
2038
+ }): FetcherWithComponents<SerializeFrom<T>>;
393
2039
  /**
394
- Returns the resolved promise value from the closest {@link Await | `<Await>`}.
2040
+ Returns an array of all in-flight fetchers. This is useful for components throughout the app that didn't create the fetchers but want to use their submissions to participate in optimistic UI.
395
2041
 
396
2042
  ```tsx
397
- function SomeDescendant() {
398
- const value = useAsyncValue();
2043
+ import { useFetchers } from "react-router";
2044
+
2045
+ function SomeComponent() {
2046
+ const fetchers = useFetchers();
2047
+ fetchers[0].formData; // FormData
2048
+ fetchers[0].state; // etc.
399
2049
  // ...
400
2050
  }
401
-
402
- // somewhere in your app
403
- <Await resolve={somePromise}>
404
- <SomeDescendant />
405
- </Await>
406
2051
  ```
407
2052
 
408
2053
  @category Hooks
409
2054
  */
410
- declare function useAsyncValue(): unknown;
2055
+ declare function useFetchers(): (Fetcher & {
2056
+ key: string;
2057
+ })[];
411
2058
  /**
412
- Returns the rejection value from the closest {@link Await | `<Await>`}.
2059
+ * When rendered inside a RouterProvider, will restore scroll positions on navigations
2060
+ */
2061
+ declare function useScrollRestoration({ getKey, storageKey, }?: {
2062
+ getKey?: GetScrollRestorationKeyFunction;
2063
+ storageKey?: string;
2064
+ }): void;
2065
+ /**
2066
+ * Setup a callback to be fired on the window's `beforeunload` event.
2067
+ *
2068
+ * @category Hooks
2069
+ */
2070
+ declare function useBeforeUnload(callback: (event: BeforeUnloadEvent) => any, options?: {
2071
+ capture?: boolean;
2072
+ }): void;
2073
+ /**
2074
+ Wrapper around useBlocker to show a window.confirm prompt to users instead of building a custom UI with {@link useBlocker}.
2075
+
2076
+ The `unstable_` flag will not be removed because this technique has a lot of rough edges and behaves very differently (and incorrectly sometimes) across browsers if users click addition back/forward navigations while the confirmation is open. Use at your own risk.
413
2077
 
414
2078
  ```tsx
415
- import { Await, useAsyncError } from "react-router"
2079
+ function ImportantForm() {
2080
+ let [value, setValue] = React.useState("");
2081
+
2082
+ // Block navigating elsewhere when data has been entered into the input
2083
+ unstable_usePrompt({
2084
+ message: "Are you sure?",
2085
+ when: ({ currentLocation, nextLocation }) =>
2086
+ value !== "" &&
2087
+ currentLocation.pathname !== nextLocation.pathname,
2088
+ });
416
2089
 
417
- function ErrorElement() {
418
- const error = useAsyncError();
419
2090
  return (
420
- <p>Uh Oh, something went wrong! {error.message}</p>
2091
+ <Form method="post">
2092
+ <label>
2093
+ Enter some important data:
2094
+ <input
2095
+ name="data"
2096
+ value={value}
2097
+ onChange={(e) => setValue(e.target.value)}
2098
+ />
2099
+ </label>
2100
+ <button type="submit">Save</button>
2101
+ </Form>
421
2102
  );
422
2103
  }
423
-
424
- // somewhere in your app
425
- <Await
426
- resolve={promiseThatRejects}
427
- errorElement={<ErrorElement />}
428
- />
429
2104
  ```
430
2105
 
431
2106
  @category Hooks
2107
+ @name unstable_usePrompt
432
2108
  */
433
- declare function useAsyncError(): unknown;
2109
+ declare function usePrompt({ when, message, }: {
2110
+ when: boolean | BlockerFunction;
2111
+ message: string;
2112
+ }): void;
434
2113
  /**
435
- * Allow the application to block navigations within the SPA and present the
436
- * user a confirmation dialog to confirm the navigation. Mostly used to avoid
437
- * using half-filled form data. This does not handle hard-reloads or
438
- * cross-origin navigations.
439
- *
440
- * @category Hooks
2114
+ This hook returns `true` when there is an active [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API) to the specified location. This can be used to apply finer-grained styles to elements to further customize the view transition. This requires that view transitions have been enabled for the given navigation via {@link LinkProps.viewTransition} (or the `Form`, `submit`, or `navigate` call)
2115
+
2116
+ @category Hooks
2117
+ @name useViewTransitionState
441
2118
  */
442
- declare function useBlocker(shouldBlock: boolean | BlockerFunction): Blocker;
2119
+ declare function useViewTransitionState(to: To, opts?: {
2120
+ relative?: RelativeRoutingType;
2121
+ }): boolean;
443
2122
 
444
2123
  interface StaticRouterProps {
445
2124
  basename?: string;
@@ -455,7 +2134,7 @@ interface StaticRouterProps {
455
2134
  declare function StaticRouter({ basename, children, location: locationProp, }: StaticRouterProps): React.JSX.Element;
456
2135
  interface StaticRouterProviderProps {
457
2136
  context: StaticHandlerContext;
458
- router: Router;
2137
+ router: Router$1;
459
2138
  hydrate?: boolean;
460
2139
  nonce?: string;
461
2140
  }
@@ -476,7 +2155,7 @@ declare function createStaticHandler(routes: RouteObject[], opts?: CreateStaticH
476
2155
  */
477
2156
  declare function createStaticRouter(routes: RouteObject[], context: StaticHandlerContext, opts?: {
478
2157
  future?: Partial<FutureConfig$1>;
479
- }): Router;
2158
+ }): Router$1;
480
2159
 
481
2160
  interface ServerRouterProps {
482
2161
  context: EntryContext;
@@ -492,19 +2171,33 @@ interface ServerRouterProps {
492
2171
  */
493
2172
  declare function ServerRouter({ context, url, nonce, }: ServerRouterProps): ReactElement;
494
2173
 
495
- interface StubIndexRouteObject extends Omit<IndexRouteObject, "loader" | "action" | "element" | "errorElement" | "children"> {
2174
+ interface StubRouteExtensions {
2175
+ Component?: React.ComponentType<{
2176
+ params: ReturnType<typeof useParams>;
2177
+ loaderData: ReturnType<typeof useLoaderData>;
2178
+ actionData: ReturnType<typeof useActionData>;
2179
+ matches: ReturnType<typeof useMatches>;
2180
+ }>;
2181
+ HydrateFallback?: React.ComponentType<{
2182
+ params: ReturnType<typeof useParams>;
2183
+ loaderData: ReturnType<typeof useLoaderData>;
2184
+ actionData: ReturnType<typeof useActionData>;
2185
+ }>;
2186
+ ErrorBoundary?: React.ComponentType<{
2187
+ params: ReturnType<typeof useParams>;
2188
+ loaderData: ReturnType<typeof useLoaderData>;
2189
+ actionData: ReturnType<typeof useActionData>;
2190
+ error: ReturnType<typeof useRouteError>;
2191
+ }>;
496
2192
  loader?: LoaderFunction;
497
2193
  action?: ActionFunction;
498
2194
  children?: StubRouteObject[];
499
2195
  meta?: MetaFunction;
500
2196
  links?: LinksFunction;
501
2197
  }
502
- interface StubNonIndexRouteObject extends Omit<NonIndexRouteObject, "loader" | "action" | "element" | "errorElement" | "children"> {
503
- loader?: LoaderFunction;
504
- action?: ActionFunction;
505
- children?: StubRouteObject[];
506
- meta?: MetaFunction;
507
- links?: LinksFunction;
2198
+ interface StubIndexRouteObject extends Omit<IndexRouteObject, "Component" | "HydrateFallback" | "ErrorBoundary" | "loader" | "action" | "element" | "errorElement" | "children">, StubRouteExtensions {
2199
+ }
2200
+ interface StubNonIndexRouteObject extends Omit<NonIndexRouteObject, "Component" | "HydrateFallback" | "ErrorBoundary" | "loader" | "action" | "element" | "errorElement" | "children">, StubRouteExtensions {
508
2201
  }
509
2202
  type StubRouteObject = StubIndexRouteObject | StubNonIndexRouteObject;
510
2203
  interface RoutesTestStubProps {
@@ -835,14 +2528,17 @@ declare class RemixErrorBoundary extends React.Component<RemixErrorBoundaryProps
835
2528
  render(): string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
836
2529
  }
837
2530
 
2531
+ declare function getPatchRoutesOnNavigationFunction(manifest: AssetsManifest, routeModules: RouteModules, ssr: boolean, routeDiscovery: ServerBuild["routeDiscovery"], isSpaMode: boolean, basename: string | undefined): PatchRoutesOnNavigationFunction | undefined;
2532
+ declare function useFogOFWarDiscovery(router: Router$1, manifest: AssetsManifest, routeModules: RouteModules, ssr: boolean, routeDiscovery: ServerBuild["routeDiscovery"], isSpaMode: boolean): void;
2533
+
838
2534
  declare function getHydrationData(state: {
839
- loaderData?: Router["state"]["loaderData"];
840
- actionData?: Router["state"]["actionData"];
841
- errors?: Router["state"]["errors"];
2535
+ loaderData?: Router$1["state"]["loaderData"];
2536
+ actionData?: Router$1["state"]["actionData"];
2537
+ errors?: Router$1["state"]["errors"];
842
2538
  }, routes: DataRouteObject[], getRouteInfo: (routeId: string) => {
843
2539
  clientLoader: ClientLoaderFunction | undefined;
844
2540
  hasLoader: boolean;
845
2541
  hasHydrateFallback: boolean;
846
2542
  }, location: Path, basename: string | undefined, isSpaMode: boolean): HydrationState;
847
2543
 
848
- export { ActionFunction, ActionFunctionArgs, AppLoadContext, Blocker, BlockerFunction, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, DataRouteObject, Router as DataRouter, DataStrategyFunction, EntryContext, type FlashSessionData, type HandleDataRequestFunction, type HandleDocumentRequestFunction, type HandleErrorFunction, HydrationState, IndexRouteObject, InitialEntry, type IsCookieFunction, type IsSessionFunction, LinksFunction, LoaderFunction, LoaderFunctionArgs, Location, MetaFunction, type NavigateFunction, NavigateOptions, Navigation, Action as NavigationType, NonIndexRouteObject, ParamParseKey, Params$1 as Params, Path, PathMatch, PathPattern, type Register, RelativeRoutingType, type RequestHandler, RevalidationState, RouteObject, RouterState, type RoutesTestStubProps, type ServerBuild, type ServerEntryModule, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, StaticHandler, StaticHandlerContext, StaticRouter, type StaticRouterProps, StaticRouterProvider, type StaticRouterProviderProps, To, UIMatch, AssetsManifest as UNSAFE_AssetsManifest, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, createCookie, createCookieSessionStorage, createMemorySessionStorage, createRequestHandler, createRoutesStub, createSession, createSessionStorage, createStaticHandler, createStaticRouter, href, isCookie, isSession, unstable_InitialContext, unstable_RouterContextProvider, setDevServerHooks as unstable_setDevServerHooks, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes };
2544
+ export { ActionFunction, ActionFunctionArgs, AppLoadContext, Await, type AwaitProps, Blocker, BlockerFunction, BrowserRouter, type BrowserRouterProps, ClientLoaderFunction, type Cookie, type CookieOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, type DOMRouterOpts, DataRouteObject, Router$1 as DataRouter, DataStrategyFunction, type EntryContext, Fetcher, type FetcherFormProps, type FetcherSubmitFunction, type FetcherSubmitOptions, type FetcherWithComponents, type FlashSessionData, Form, FormEncType, type FormProps, GetScrollRestorationKeyFunction, HTMLFormMethod, type HandleDataRequestFunction, type HandleDocumentRequestFunction, type HandleErrorFunction, HashRouter, type HashRouterProps, type HistoryRouterProps, HydrationState, IndexRouteObject, type IndexRouteProps, InitialEntry, type IsCookieFunction, type IsSessionFunction, type LayoutRouteProps, LazyRouteFunction, Link, type LinkProps, Links, LinksFunction, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouter, type MemoryRouterOpts, type MemoryRouterProps, Meta, MetaFunction, NavLink, type NavLinkProps, type NavLinkRenderProps, Navigate, type NavigateFunction, NavigateOptions, type NavigateProps, Navigation, Action as NavigationType, Navigator, NonIndexRouteObject, Outlet, type OutletProps, PageLinkDescriptor, type ParamKeyValuePair, ParamParseKey, Params$1 as Params, PatchRoutesOnNavigationFunction, Path, PathMatch, PathPattern, type PathRouteProps, PrefetchPageLinks, type Register, RelativeRoutingType, type RequestHandler, Route$1 as Route, RouteMatch, RouteObject, type RouteProps, Router, RouterInit, type RouterProps, RouterProvider, type RouterProviderProps, RouterState, Routes, type RoutesProps, type RoutesTestStubProps, Scripts, type ScriptsProps, ScrollRestoration, type ScrollRestorationProps, type ServerBuild, type ServerEntryModule, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, type SetURLSearchParams, StaticHandler, StaticHandlerContext, StaticRouter, type StaticRouterProps, StaticRouterProvider, type StaticRouterProviderProps, type SubmitFunction, type SubmitOptions, type SubmitTarget, To, UIMatch, type AssetsManifest as UNSAFE_AssetsManifest, FrameworkContext as UNSAFE_FrameworkContext, MiddlewareEnabled as UNSAFE_MiddlewareEnabled, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, createClientRoutes as UNSAFE_createClientRoutes, createClientRoutesWithHMRRevalidationOptOut as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, deserializeErrors as UNSAFE_deserializeErrors, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, hydrationRouteProperties as UNSAFE_hydrationRouteProperties, mapRouteProperties as UNSAFE_mapRouteProperties, shouldHydrateRouteLoader as UNSAFE_shouldHydrateRouteLoader, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, useScrollRestoration as UNSAFE_useScrollRestoration, type URLSearchParamsInit, createBrowserRouter, createCookie, createCookieSessionStorage, createHashRouter, createMemoryRouter, createMemorySessionStorage, createRequestHandler, createRoutesFromChildren, createRoutesFromElements, createRoutesStub, createSearchParams, createSession, createSessionStorage, createStaticHandler, createStaticRouter, href, isCookie, isSession, renderMatches, HistoryRouter as unstable_HistoryRouter, unstable_InitialContext, unstable_RouterContextProvider, setDevServerHooks as unstable_setDevServerHooks, usePrompt as unstable_usePrompt, useActionData, useAsyncError, useAsyncValue, useBeforeUnload, useBlocker, useFetcher, useFetchers, useFormAction, useHref, useInRouterContext, useLinkClickHandler, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, useSearchParams, useSubmit, useViewTransitionState };