react-router 6.0.0 → 6.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -37,7 +37,7 @@ export interface MemoryRouterProps {
37
37
  /**
38
38
  * A <Router> that stores all entries in memory.
39
39
  *
40
- * @see https://reactrouter.com/api/MemoryRouter
40
+ * @see https://reactrouter.com/docs/en/v6/api#memoryrouter
41
41
  */
42
42
  export declare function MemoryRouter({ basename, children, initialEntries, initialIndex }: MemoryRouterProps): React.ReactElement;
43
43
  export interface NavigateProps {
@@ -52,7 +52,7 @@ export interface NavigateProps {
52
52
  * able to use hooks. In functional components, we recommend you use the
53
53
  * `useNavigate` hook instead.
54
54
  *
55
- * @see https://reactrouter.com/api/Navigate
55
+ * @see https://reactrouter.com/docs/en/v6/api#navigate
56
56
  */
57
57
  export declare function Navigate({ to, replace, state }: NavigateProps): null;
58
58
  export interface OutletProps {
@@ -60,7 +60,7 @@ export interface OutletProps {
60
60
  /**
61
61
  * Renders the child route's element, if there is one.
62
62
  *
63
- * @see https://reactrouter.com/api/Outlet
63
+ * @see https://reactrouter.com/docs/en/v6/api#outlet
64
64
  */
65
65
  export declare function Outlet(_props: OutletProps): React.ReactElement | null;
66
66
  export interface RouteProps {
@@ -88,7 +88,7 @@ export interface IndexRouteProps {
88
88
  /**
89
89
  * Declares an element that should be rendered at a certain URL path.
90
90
  *
91
- * @see https://reactrouter.com/api/Route
91
+ * @see https://reactrouter.com/docs/en/v6/api#route
92
92
  */
93
93
  export declare function Route(_props: PathRouteProps | LayoutRouteProps | IndexRouteProps): React.ReactElement | null;
94
94
  export interface RouterProps {
@@ -106,7 +106,7 @@ export interface RouterProps {
106
106
  * router that is more specific to your environment such as a <BrowserRouter>
107
107
  * in web browsers or a <StaticRouter> for server rendering.
108
108
  *
109
- * @see https://reactrouter.com/api/Router
109
+ * @see https://reactrouter.com/docs/en/v6/api#router
110
110
  */
111
111
  export declare function Router({ basename: basenameProp, children, location: locationProp, navigationType, navigator, static: staticProp }: RouterProps): React.ReactElement | null;
112
112
  export interface RoutesProps {
@@ -117,20 +117,20 @@ export interface RoutesProps {
117
117
  * A container for a nested tree of <Route> elements that renders the branch
118
118
  * that best matches the current location.
119
119
  *
120
- * @see https://reactrouter.com/api/Routes
120
+ * @see https://reactrouter.com/docs/en/v6/api#routes
121
121
  */
122
122
  export declare function Routes({ children, location }: RoutesProps): React.ReactElement | null;
123
123
  /**
124
124
  * Returns the full href for the given "to" value. This is useful for building
125
125
  * custom links that are also accessible and preserve right-click behavior.
126
126
  *
127
- * @see https://reactrouter.com/api/useHref
127
+ * @see https://reactrouter.com/docs/en/v6/api#usehref
128
128
  */
129
129
  export declare function useHref(to: To): string;
130
130
  /**
131
131
  * Returns true if this component is a descendant of a <Router>.
132
132
  *
133
- * @see https://reactrouter.com/api/useInRouterContext
133
+ * @see https://reactrouter.com/docs/en/v6/api#useinroutercontext
134
134
  */
135
135
  export declare function useInRouterContext(): boolean;
136
136
  /**
@@ -141,14 +141,14 @@ export declare function useInRouterContext(): boolean;
141
141
  * "routing" in your app, and we'd like to know what your use case is. We may
142
142
  * be able to provide something higher-level to better suit your needs.
143
143
  *
144
- * @see https://reactrouter.com/api/useLocation
144
+ * @see https://reactrouter.com/docs/en/v6/api#uselocation
145
145
  */
146
146
  export declare function useLocation(): Location;
147
147
  /**
148
148
  * Returns the current navigation action which describes how the router came to
149
149
  * the current location, either by a pop, push, or replace on the history stack.
150
150
  *
151
- * @see https://reactrouter.com/api/useNavigationType
151
+ * @see https://reactrouter.com/docs/en/v6/api#usenavigationtype
152
152
  */
153
153
  export declare function useNavigationType(): NavigationType;
154
154
  /**
@@ -156,7 +156,7 @@ export declare function useNavigationType(): NavigationType;
156
156
  * This is useful for components that need to know "active" state, e.g.
157
157
  * <NavLink>.
158
158
  *
159
- * @see https://reactrouter.com/api/useMatch
159
+ * @see https://reactrouter.com/docs/en/v6/api#usematch
160
160
  */
161
161
  export declare function useMatch<ParamKey extends string = string>(pattern: PathPattern | string): PathMatch<ParamKey> | null;
162
162
  /**
@@ -174,27 +174,27 @@ export interface NavigateOptions {
174
174
  * Returns an imperative method for changing the location. Used by <Link>s, but
175
175
  * may also be used by other elements to change the location.
176
176
  *
177
- * @see https://reactrouter.com/api/useNavigate
177
+ * @see https://reactrouter.com/docs/en/v6/api#usenavigate
178
178
  */
179
179
  export declare function useNavigate(): NavigateFunction;
180
180
  /**
181
181
  * Returns the element for the child route at this level of the route
182
182
  * hierarchy. Used internally by <Outlet> to render child routes.
183
183
  *
184
- * @see https://reactrouter.com/api/useOutlet
184
+ * @see https://reactrouter.com/docs/en/v6/api#useoutlet
185
185
  */
186
186
  export declare function useOutlet(): React.ReactElement | null;
187
187
  /**
188
188
  * Returns an object of key/value pairs of the dynamic params from the current
189
189
  * URL that were matched by the route path.
190
190
  *
191
- * @see https://reactrouter.com/api/useParams
191
+ * @see https://reactrouter.com/docs/en/v6/api#useparams
192
192
  */
193
193
  export declare function useParams<Key extends string = string>(): Readonly<Params<Key>>;
194
194
  /**
195
195
  * Resolves the pathname of the given `to` value against the current location.
196
196
  *
197
- * @see https://reactrouter.com/api/useResolvedPath
197
+ * @see https://reactrouter.com/docs/en/v6/api#useresolvedpath
198
198
  */
199
199
  export declare function useResolvedPath(to: To): Path;
200
200
  /**
@@ -203,7 +203,7 @@ export declare function useResolvedPath(to: To): Path;
203
203
  * elements in the tree must render an <Outlet> to render their child route's
204
204
  * element.
205
205
  *
206
- * @see https://reactrouter.com/api/useRoutes
206
+ * @see https://reactrouter.com/docs/en/v6/api#useroutes
207
207
  */
208
208
  export declare function useRoutes(routes: RouteObject[], locationArg?: Partial<Location> | string): React.ReactElement | null;
209
209
  /**
@@ -211,7 +211,7 @@ export declare function useRoutes(routes: RouteObject[], locationArg?: Partial<L
211
211
  * either a `<Route>` element or an array of them. Used internally by
212
212
  * `<Routes>` to create a route config from its children.
213
213
  *
214
- * @see https://reactrouter.com/api/createRoutesFromChildren
214
+ * @see https://reactrouter.com/docs/en/v6/api#createroutesfromchildren
215
215
  */
216
216
  export declare function createRoutesFromChildren(children: React.ReactNode): RouteObject[];
217
217
  /**
@@ -234,7 +234,7 @@ export interface RouteObject {
234
234
  /**
235
235
  * Returns a path with params interpolated.
236
236
  *
237
- * @see https://reactrouter.com/api/generatePath
237
+ * @see https://reactrouter.com/docs/en/v6/api#generatepath
238
238
  */
239
239
  export declare function generatePath(path: string, params?: Params): string;
240
240
  /**
@@ -261,7 +261,7 @@ export interface RouteMatch<ParamKey extends string = string> {
261
261
  /**
262
262
  * Matches the given routes to a location and returns the match data.
263
263
  *
264
- * @see https://reactrouter.com/api/matchRoutes
264
+ * @see https://reactrouter.com/docs/en/v6/api#matchroutes
265
265
  */
266
266
  export declare function matchRoutes(routes: RouteObject[], locationArg: Partial<Location> | string, basename?: string): RouteMatch[] | null;
267
267
  /**
@@ -313,13 +313,13 @@ export interface PathMatch<ParamKey extends string = string> {
313
313
  * Performs pattern matching on a URL pathname and returns information about
314
314
  * the match.
315
315
  *
316
- * @see https://reactrouter.com/api/matchPath
316
+ * @see https://reactrouter.com/docs/en/v6/api#matchpath
317
317
  */
318
318
  export declare function matchPath<ParamKey extends string = string>(pattern: PathPattern | string, pathname: string): PathMatch<ParamKey> | null;
319
319
  /**
320
320
  * Returns a resolved path object relative to the given pathname.
321
321
  *
322
- * @see https://reactrouter.com/api/resolvePath
322
+ * @see https://reactrouter.com/docs/en/v6/api#resolvepath
323
323
  */
324
324
  export declare function resolvePath(to: To, fromPathname?: string): Path;
325
325
  /** @internal */
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * React Router v6.0.0
2
+ * React Router v6.0.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -80,7 +80,7 @@ if (process.env.NODE_ENV !== "production") {
80
80
  /**
81
81
  * A <Router> that stores all entries in memory.
82
82
  *
83
- * @see https://reactrouter.com/api/MemoryRouter
83
+ * @see https://reactrouter.com/docs/en/v6/api#memoryrouter
84
84
  */
85
85
  function MemoryRouter(_ref) {
86
86
  let {
@@ -120,7 +120,7 @@ function MemoryRouter(_ref) {
120
120
  * able to use hooks. In functional components, we recommend you use the
121
121
  * `useNavigate` hook instead.
122
122
  *
123
- * @see https://reactrouter.com/api/Navigate
123
+ * @see https://reactrouter.com/docs/en/v6/api#navigate
124
124
  */
125
125
  function Navigate(_ref2) {
126
126
  let {
@@ -145,7 +145,7 @@ function Navigate(_ref2) {
145
145
  /**
146
146
  * Renders the child route's element, if there is one.
147
147
  *
148
- * @see https://reactrouter.com/api/Outlet
148
+ * @see https://reactrouter.com/docs/en/v6/api#outlet
149
149
  */
150
150
  function Outlet(_props) {
151
151
  return useOutlet();
@@ -154,7 +154,7 @@ function Outlet(_props) {
154
154
  /**
155
155
  * Declares an element that should be rendered at a certain URL path.
156
156
  *
157
- * @see https://reactrouter.com/api/Route
157
+ * @see https://reactrouter.com/docs/en/v6/api#route
158
158
  */
159
159
  function Route(_props) {
160
160
  process.env.NODE_ENV !== "production" ? invariant(false, "A <Route> is only ever to be used as the child of <Routes> element, " + "never rendered directly. Please wrap your <Route> in a <Routes>.") : invariant(false) ;
@@ -167,7 +167,7 @@ function Route(_props) {
167
167
  * router that is more specific to your environment such as a <BrowserRouter>
168
168
  * in web browsers or a <StaticRouter> for server rendering.
169
169
  *
170
- * @see https://reactrouter.com/api/Router
170
+ * @see https://reactrouter.com/docs/en/v6/api#router
171
171
  */
172
172
  function Router(_ref3) {
173
173
  let {
@@ -233,7 +233,7 @@ function Router(_ref3) {
233
233
  * A container for a nested tree of <Route> elements that renders the branch
234
234
  * that best matches the current location.
235
235
  *
236
- * @see https://reactrouter.com/api/Routes
236
+ * @see https://reactrouter.com/docs/en/v6/api#routes
237
237
  */
238
238
  function Routes(_ref4) {
239
239
  let {
@@ -249,7 +249,7 @@ function Routes(_ref4) {
249
249
  * Returns the full href for the given "to" value. This is useful for building
250
250
  * custom links that are also accessible and preserve right-click behavior.
251
251
  *
252
- * @see https://reactrouter.com/api/useHref
252
+ * @see https://reactrouter.com/docs/en/v6/api#usehref
253
253
  */
254
254
 
255
255
  function useHref(to) {
@@ -282,7 +282,7 @@ function useHref(to) {
282
282
  /**
283
283
  * Returns true if this component is a descendant of a <Router>.
284
284
  *
285
- * @see https://reactrouter.com/api/useInRouterContext
285
+ * @see https://reactrouter.com/docs/en/v6/api#useinroutercontext
286
286
  */
287
287
 
288
288
  function useInRouterContext() {
@@ -296,7 +296,7 @@ function useInRouterContext() {
296
296
  * "routing" in your app, and we'd like to know what your use case is. We may
297
297
  * be able to provide something higher-level to better suit your needs.
298
298
  *
299
- * @see https://reactrouter.com/api/useLocation
299
+ * @see https://reactrouter.com/docs/en/v6/api#uselocation
300
300
  */
301
301
 
302
302
  function useLocation() {
@@ -309,7 +309,7 @@ function useLocation() {
309
309
  * Returns the current navigation action which describes how the router came to
310
310
  * the current location, either by a pop, push, or replace on the history stack.
311
311
  *
312
- * @see https://reactrouter.com/api/useNavigationType
312
+ * @see https://reactrouter.com/docs/en/v6/api#usenavigationtype
313
313
  */
314
314
 
315
315
  function useNavigationType() {
@@ -320,7 +320,7 @@ function useNavigationType() {
320
320
  * This is useful for components that need to know "active" state, e.g.
321
321
  * <NavLink>.
322
322
  *
323
- * @see https://reactrouter.com/api/useMatch
323
+ * @see https://reactrouter.com/docs/en/v6/api#usematch
324
324
  */
325
325
 
326
326
  function useMatch(pattern) {
@@ -337,7 +337,7 @@ function useMatch(pattern) {
337
337
  * Returns an imperative method for changing the location. Used by <Link>s, but
338
338
  * may also be used by other elements to change the location.
339
339
  *
340
- * @see https://reactrouter.com/api/useNavigate
340
+ * @see https://reactrouter.com/docs/en/v6/api#usenavigate
341
341
  */
342
342
  function useNavigate() {
343
343
  !useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(false, // TODO: This error is probably because they somehow have 2 versions of the
@@ -385,7 +385,7 @@ function useNavigate() {
385
385
  * Returns the element for the child route at this level of the route
386
386
  * hierarchy. Used internally by <Outlet> to render child routes.
387
387
  *
388
- * @see https://reactrouter.com/api/useOutlet
388
+ * @see https://reactrouter.com/docs/en/v6/api#useoutlet
389
389
  */
390
390
 
391
391
  function useOutlet() {
@@ -395,7 +395,7 @@ function useOutlet() {
395
395
  * Returns an object of key/value pairs of the dynamic params from the current
396
396
  * URL that were matched by the route path.
397
397
  *
398
- * @see https://reactrouter.com/api/useParams
398
+ * @see https://reactrouter.com/docs/en/v6/api#useparams
399
399
  */
400
400
 
401
401
  function useParams() {
@@ -408,7 +408,7 @@ function useParams() {
408
408
  /**
409
409
  * Resolves the pathname of the given `to` value against the current location.
410
410
  *
411
- * @see https://reactrouter.com/api/useResolvedPath
411
+ * @see https://reactrouter.com/docs/en/v6/api#useresolvedpath
412
412
  */
413
413
 
414
414
  function useResolvedPath(to) {
@@ -427,7 +427,7 @@ function useResolvedPath(to) {
427
427
  * elements in the tree must render an <Outlet> to render their child route's
428
428
  * element.
429
429
  *
430
- * @see https://reactrouter.com/api/useRoutes
430
+ * @see https://reactrouter.com/docs/en/v6/api#useroutes
431
431
  */
432
432
 
433
433
  function useRoutes(routes, locationArg) {
@@ -506,7 +506,7 @@ function useRoutes(routes, locationArg) {
506
506
  * either a `<Route>` element or an array of them. Used internally by
507
507
  * `<Routes>` to create a route config from its children.
508
508
  *
509
- * @see https://reactrouter.com/api/createRoutesFromChildren
509
+ * @see https://reactrouter.com/docs/en/v6/api#createroutesfromchildren
510
510
  */
511
511
 
512
512
  function createRoutesFromChildren(children) {
@@ -524,6 +524,7 @@ function createRoutesFromChildren(children) {
524
524
  return;
525
525
  }
526
526
 
527
+ !(element.type === Route) ? process.env.NODE_ENV !== "production" ? invariant(false, "[" + (typeof element.type === "string" ? element.type : element.type.name) + "] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>") : invariant(false) : void 0;
527
528
  let route = {
528
529
  caseSensitive: element.props.caseSensitive,
529
530
  element: element.props.element,
@@ -546,7 +547,7 @@ function createRoutesFromChildren(children) {
546
547
  /**
547
548
  * Returns a path with params interpolated.
548
549
  *
549
- * @see https://reactrouter.com/api/generatePath
550
+ * @see https://reactrouter.com/docs/en/v6/api#generatepath
550
551
  */
551
552
  function generatePath(path, params) {
552
553
  if (params === void 0) {
@@ -565,7 +566,7 @@ function generatePath(path, params) {
565
566
  /**
566
567
  * Matches the given routes to a location and returns the match data.
567
568
  *
568
- * @see https://reactrouter.com/api/matchRoutes
569
+ * @see https://reactrouter.com/docs/en/v6/api#matchroutes
569
570
  */
570
571
  function matchRoutes(routes, locationArg, basename) {
571
572
  if (basename === void 0) {
@@ -752,7 +753,7 @@ function _renderMatches(matches, parentMatches) {
752
753
  * Performs pattern matching on a URL pathname and returns information about
753
754
  * the match.
754
755
  *
755
- * @see https://reactrouter.com/api/matchPath
756
+ * @see https://reactrouter.com/docs/en/v6/api#matchpath
756
757
  */
757
758
  function matchPath(pattern, pathname) {
758
759
  if (typeof pattern === "string") {
@@ -834,7 +835,7 @@ function safelyDecodeURIComponent(value, paramName) {
834
835
  /**
835
836
  * Returns a resolved path object relative to the given pathname.
836
837
  *
837
- * @see https://reactrouter.com/api/resolvePath
838
+ * @see https://reactrouter.com/docs/en/v6/api#resolvepath
838
839
  */
839
840
 
840
841