react-router 0.0.0-experimental-e5dac68cb → 0.0.0-experimental-7a7fadb20

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