react-router 6.4.0-pre.8 → 6.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,16 @@
1
1
  import * as React from "react";
2
- import { Location, ParamParseKey, Params, Path, PathMatch, PathPattern, RouteMatch, RouteObject, Router as DataRouter, To } from "@remix-run/router";
2
+ import type { Location, ParamParseKey, Params, Path, PathMatch, PathPattern, Router as RemixRouter, To } from "@remix-run/router";
3
3
  import { Action as NavigationType } from "@remix-run/router";
4
- import { NavigateOptions } from "./context";
4
+ import type { NavigateOptions, RouteMatch, RouteObject, RelativeRoutingType } from "./context";
5
5
  /**
6
6
  * Returns the full href for the given "to" value. This is useful for building
7
7
  * custom links that are also accessible and preserve right-click behavior.
8
8
  *
9
9
  * @see https://reactrouter.com/docs/en/v6/hooks/use-href
10
10
  */
11
- export declare function useHref(to: To): string;
11
+ export declare function useHref(to: To, { relative }?: {
12
+ relative?: RelativeRoutingType;
13
+ }): string;
12
14
  /**
13
15
  * Returns true if this component is a descendant of a <Router>.
14
16
  *
@@ -82,7 +84,9 @@ export declare function useParams<ParamsOrKey extends string | Record<string, st
82
84
  *
83
85
  * @see https://reactrouter.com/docs/en/v6/hooks/use-resolved-path
84
86
  */
85
- export declare function useResolvedPath(to: To): Path;
87
+ export declare function useResolvedPath(to: To, { relative }?: {
88
+ relative?: RelativeRoutingType;
89
+ }): Path;
86
90
  /**
87
91
  * Returns the element of the route that matched the current location, prepared
88
92
  * with the correct context to render the remainder of the route tree. Route
@@ -111,9 +115,9 @@ export declare class RenderErrorBoundary extends React.Component<RenderErrorBoun
111
115
  location: Location;
112
116
  };
113
117
  componentDidCatch(error: any, errorInfo: any): void;
114
- render(): React.ReactNode;
118
+ render(): string | number | boolean | React.ReactFragment | JSX.Element | null | undefined;
115
119
  }
116
- export declare function _renderMatches(matches: RouteMatch[] | null, parentMatches?: RouteMatch[], dataRouterState?: DataRouter["state"]): React.ReactElement | null;
120
+ export declare function _renderMatches(matches: RouteMatch[] | null, parentMatches?: RouteMatch[], dataRouterState?: RemixRouter["state"]): React.ReactElement | null;
117
121
  /**
118
122
  * Returns the current navigation, defaulting to an "idle" navigation when
119
123
  * no navigation is in progress
@@ -135,25 +139,33 @@ export declare function useMatches(): {
135
139
  id: string;
136
140
  pathname: string;
137
141
  params: Params<string>;
138
- data: any;
139
- handle: any;
142
+ data: unknown;
143
+ handle: unknown;
140
144
  }[];
141
145
  /**
142
146
  * Returns the loader data for the nearest ancestor Route loader
143
147
  */
144
- export declare function useLoaderData(): any;
148
+ export declare function useLoaderData(): unknown;
145
149
  /**
146
150
  * Returns the loaderData for the given routeId
147
151
  */
148
- export declare function useRouteLoaderData(routeId: string): any | undefined;
152
+ export declare function useRouteLoaderData(routeId: string): unknown;
149
153
  /**
150
154
  * Returns the action data for the nearest ancestor Route action
151
155
  */
152
- export declare function useActionData(): any;
156
+ export declare function useActionData(): unknown;
153
157
  /**
154
158
  * Returns the nearest ancestor Route error, which could be a loader/action
155
159
  * error or a render error. This is intended to be called from your
156
160
  * errorElement to display a proper error message.
157
161
  */
158
- export declare function useRouteError(): any;
162
+ export declare function useRouteError(): unknown;
163
+ /**
164
+ * Returns the happy-path data from the nearest ancestor <Await /> value
165
+ */
166
+ export declare function useAsyncValue(): unknown;
167
+ /**
168
+ * Returns the error from the nearest ancestor <Await /> value
169
+ */
170
+ export declare function useAsyncError(): unknown;
159
171
  export {};
@@ -3,4 +3,5 @@
3
3
  * provide a UMD-compatible package, so we need this to be able to distribute
4
4
  * UMD react-router bundles
5
5
  */
6
- export declare const useSyncExternalStore: any;
6
+ import { useSyncExternalStore as server } from "./useSyncExternalStoreShimServer";
7
+ export declare const useSyncExternalStore: typeof server;
package/dist/main.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * React Router v6.4.0-pre.8
2
+ * React Router v6.4.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *