react-router
Advanced tools
Comparing version 0.0.0-experimental-7c2094e9e to 0.0.0-experimental-7c6c0664d
# `react-router` | ||
## 6.26.1 | ||
### Patch Changes | ||
- Rename `unstable_patchRoutesOnMiss` to `unstable_patchRoutesOnNavigation` to match new behavior ([#11888](https://github.com/remix-run/react-router/pull/11888)) | ||
- Updated dependencies: | ||
- `@remix-run/router@1.19.1` | ||
## 6.26.0 | ||
### Minor Changes | ||
- Add a new `replace(url, init?)` alternative to `redirect(url, init?)` that performs a `history.replaceState` instead of a `history.pushState` on client-side navigation redirects ([#11811](https://github.com/remix-run/react-router/pull/11811)) | ||
### Patch Changes | ||
- Fix initial hydration behavior when using `future.v7_partialHydration` along with `unstable_patchRoutesOnMiss` ([#11838](https://github.com/remix-run/react-router/pull/11838)) | ||
- During initial hydration, `router.state.matches` will now include any partial matches so that we can render ancestor `HydrateFallback` components | ||
- Updated dependencies: | ||
- `@remix-run/router@1.19.0` | ||
## 6.25.1 | ||
No significant changes to this package were made in this release. [See the repo `CHANGELOG.md`](https://github.com/remix-run/react-router/blob/main/CHANGELOG.md) for an overview of all changes in v6.25.1. | ||
## 6.25.0 | ||
### Minor Changes | ||
- Stabilize `future.unstable_skipActionErrorRevalidation` as `future.v7_skipActionErrorRevalidation` ([#11769](https://github.com/remix-run/react-router/pull/11769)) | ||
- When this flag is enabled, actions will not automatically trigger a revalidation if they return/throw a `Response` with a `4xx`/`5xx` status code | ||
- You may still opt-into revalidation via `shouldRevalidate` | ||
- This also changes `shouldRevalidate`'s `unstable_actionStatus` parameter to `actionStatus` | ||
### Patch Changes | ||
- Fix regression and properly decode paths inside `useMatch` so matches/params reflect decoded params ([#11789](https://github.com/remix-run/react-router/pull/11789)) | ||
- Updated dependencies: | ||
- `@remix-run/router@1.18.0` | ||
## 6.24.1 | ||
@@ -16,3 +56,2 @@ | ||
- Add support for Lazy Route Discovery (a.k.a. Fog of War) ([#11626](https://github.com/remix-run/react-router/pull/11626)) | ||
- RFC: <https://github.com/remix-run/react-router/discussions/11113> | ||
@@ -19,0 +58,0 @@ - `unstable_patchRoutesOnMiss` docs: <https://reactrouter.com/en/main/routers/create-browser-router> |
@@ -1,29 +0,73 @@ | ||
import type { ActionFunction, ActionFunctionArgs, Blocker, BlockerFunction, unstable_DataStrategyFunction, unstable_DataStrategyFunctionArgs, unstable_DataStrategyMatch, ErrorResponse, Fetcher, HydrationState, InitialEntry, JsonFunction, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, Location, Navigation, ParamParseKey, Params, Path, PathMatch, PathParam, PathPattern, RedirectFunction, RelativeRoutingType, Router as RemixRouter, FutureConfig as RouterFutureConfig, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, To, UIMatch, unstable_HandlerResult, unstable_AgnosticPatchRoutesOnMissFunction } from "@remix-run/router"; | ||
import { AbortedDeferredError, Action as NavigationType, createPath, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, resolvePath } from "@remix-run/router"; | ||
import type { AwaitProps, FutureConfig, IndexRouteProps, LayoutRouteProps, MemoryRouterProps, NavigateProps, OutletProps, PathRouteProps, RouteProps, RouterProps, RouterProviderProps, RoutesProps } from "./lib/components"; | ||
import { Await, MemoryRouter, Navigate, Outlet, Route, Router, RouterProvider, Routes, createRoutesFromChildren, renderMatches } from "./lib/components"; | ||
import type { DataRouteMatch, DataRouteObject, IndexRouteObject, NavigateOptions, Navigator, NonIndexRouteObject, RouteMatch, RouteObject } from "./lib/context"; | ||
import { DataRouterContext, DataRouterStateContext, LocationContext, NavigationContext, RouteContext } from "./lib/context"; | ||
import type { NavigateFunction } from "./lib/hooks"; | ||
import { useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteId, useRouteLoaderData, useRoutes, useRoutesImpl } from "./lib/hooks"; | ||
type Hash = string; | ||
type Pathname = string; | ||
type Search = string; | ||
export type { ActionFunction, ActionFunctionArgs, AwaitProps, DataRouteMatch, DataRouteObject, unstable_DataStrategyFunction, unstable_DataStrategyFunctionArgs, unstable_DataStrategyMatch, ErrorResponse, Fetcher, FutureConfig, Hash, IndexRouteObject, IndexRouteProps, JsonFunction, LayoutRouteProps, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, NonIndexRouteObject, OutletProps, ParamParseKey, Params, Path, PathMatch, PathParam, PathPattern, PathRouteProps, Pathname, RedirectFunction, RelativeRoutingType, RouteMatch, RouteObject, RouteProps, RouterProps, RouterProviderProps, RoutesProps, Search, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, To, UIMatch, Blocker, BlockerFunction, unstable_HandlerResult, }; | ||
export { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, RouterProvider, Routes, createPath, createRoutesFromChildren, createRoutesFromChildren as createRoutesFromElements, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, renderMatches, resolvePath, useBlocker, useActionData, useAsyncError, useAsyncValue, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, }; | ||
declare function mapRouteProperties(route: RouteObject): Partial<RouteObject> & { | ||
hasErrorBoundary: boolean; | ||
}; | ||
export interface unstable_PatchRoutesOnMissFunction extends unstable_AgnosticPatchRoutesOnMissFunction<RouteMatch> { | ||
} | ||
export declare function createMemoryRouter(routes: RouteObject[], opts?: { | ||
basename?: string; | ||
future?: Partial<Omit<RouterFutureConfig, "v7_prependBasename">>; | ||
hydrationData?: HydrationState; | ||
initialEntries?: InitialEntry[]; | ||
initialIndex?: number; | ||
unstable_dataStrategy?: unstable_DataStrategyFunction; | ||
unstable_patchRoutesOnMiss?: unstable_PatchRoutesOnMissFunction; | ||
}): RemixRouter; | ||
export type { InitialEntry, Location, Path, To } from "./lib/router/history"; | ||
export type { HydrationState, StaticHandler, GetScrollPositionFunction, GetScrollRestorationKeyFunction, StaticHandlerContext, Fetcher, Navigation, NavigationStates, RelativeRoutingType, Blocker, BlockerFunction, Router as DataRouter, RouterState, RouterInit, RouterSubscriber, RouterNavigateOptions, RouterFetchOptions, RevalidationState, } from "./lib/router/router"; | ||
export type { ActionFunction, ActionFunctionArgs, DataStrategyFunction, DataStrategyFunctionArgs, DataStrategyMatch, DataStrategyResult, DataWithResponseInit as UNSAFE_DataWithResponseInit, ErrorResponse, FormEncType, FormMethod, HTMLFormMethod, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, ParamParseKey, Params, PathMatch, PathParam, PathPattern, RedirectFunction, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, UIMatch, } from "./lib/router/utils"; | ||
export { Action as NavigationType, createPath, parsePath, } from "./lib/router/history"; | ||
export { IDLE_NAVIGATION, IDLE_FETCHER, IDLE_BLOCKER, } from "./lib/router/router"; | ||
export { data, generatePath, isRouteErrorResponse, matchPath, matchRoutes, redirect, redirectDocument, replace, resolvePath, } from "./lib/router/utils"; | ||
export type { DataRouteMatch, DataRouteObject, IndexRouteObject, NavigateOptions, Navigator, NonIndexRouteObject, PatchRoutesOnNavigationFunction, PatchRoutesOnNavigationFunctionArgs, RouteMatch, RouteObject, } from "./lib/context"; | ||
export type { AwaitProps, IndexRouteProps, LayoutRouteProps, MemoryRouterProps, NavigateProps, OutletProps, PathRouteProps, RouteProps, RouterProps, RouterProviderProps, RoutesProps, } from "./lib/components"; | ||
export type { NavigateFunction } from "./lib/hooks"; | ||
export { Await, MemoryRouter, Navigate, Outlet, Route, Router, RouterProvider, Routes, createMemoryRouter, createRoutesFromChildren, createRoutesFromChildren as createRoutesFromElements, renderMatches, } from "./lib/components"; | ||
export { useBlocker, useActionData, useAsyncError, useAsyncValue, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, } from "./lib/hooks"; | ||
export type { BrowserRouterProps, HashRouterProps, HistoryRouterProps, LinkProps, NavLinkProps, NavLinkRenderProps, FetcherFormProps, FormProps, ScrollRestorationProps, SetURLSearchParams, SubmitFunction, FetcherSubmitFunction, FetcherWithComponents, } from "./lib/dom/lib"; | ||
export { createBrowserRouter, createHashRouter, BrowserRouter, HashRouter, Link, HistoryRouter as unstable_HistoryRouter, NavLink, Form, ScrollRestoration, useLinkClickHandler, useSearchParams, useSubmit, useFormAction, useFetcher, useFetchers, useBeforeUnload, usePrompt as unstable_usePrompt, useViewTransitionState, } from "./lib/dom/lib"; | ||
export type { FetcherSubmitOptions, ParamKeyValuePair, SubmitOptions, URLSearchParamsInit, SubmitTarget, } from "./lib/dom/dom"; | ||
export { createSearchParams } from "./lib/dom/dom"; | ||
export type { StaticRouterProps, StaticRouterProviderProps, } from "./lib/dom/server"; | ||
export { createStaticHandler, createStaticRouter, StaticRouter, StaticRouterProvider, } from "./lib/dom/server"; | ||
export { Meta, Links, Scripts, PrefetchPageLinks, } from "./lib/dom/ssr/components"; | ||
export type { ScriptsProps } from "./lib/dom/ssr/components"; | ||
export type { EntryContext } from "./lib/dom/ssr/entry"; | ||
export type { ClientActionFunction, ClientActionFunctionArgs, ClientLoaderFunction, ClientLoaderFunctionArgs, MetaArgs, MetaDescriptor, MetaFunction, LinksFunction, } from "./lib/dom/ssr/routeModules"; | ||
export type { ServerRouterProps } from "./lib/dom/ssr/server"; | ||
export { ServerRouter } from "./lib/dom/ssr/server"; | ||
export type { RoutesTestStubProps } from "./lib/dom/ssr/routes-test-stub"; | ||
export { createRoutesStub } from "./lib/dom/ssr/routes-test-stub"; | ||
export { createCookie, isCookie } from "./lib/server-runtime/cookies"; | ||
export { createRequestHandler } from "./lib/server-runtime/server"; | ||
export { createSession, createSessionStorage, isSession, } from "./lib/server-runtime/sessions"; | ||
export { createCookieSessionStorage } from "./lib/server-runtime/sessions/cookieStorage"; | ||
export { createMemorySessionStorage } from "./lib/server-runtime/sessions/memoryStorage"; | ||
export { setDevServerHooks as unstable_setDevServerHooks } from "./lib/server-runtime/dev"; | ||
export type { IsCookieFunction } from "./lib/server-runtime/cookies"; | ||
export type { CreateRequestHandlerFunction } from "./lib/server-runtime/server"; | ||
export type { IsSessionFunction } from "./lib/server-runtime/sessions"; | ||
export type { HandleDataRequestFunction, HandleDocumentRequestFunction, HandleErrorFunction, ServerBuild, ServerEntryModule, } from "./lib/server-runtime/build"; | ||
export type { Cookie, CookieOptions, CookieParseOptions, CookieSerializeOptions, CookieSignatureOptions, } from "./lib/server-runtime/cookies"; | ||
export type { AppLoadContext } from "./lib/server-runtime/data"; | ||
export type { PageLinkDescriptor, HtmlLinkDescriptor, LinkDescriptor, } from "./lib/router/links"; | ||
export type { HeadersArgs, HeadersFunction, } from "./lib/server-runtime/routeModules"; | ||
export type { RequestHandler } from "./lib/server-runtime/server"; | ||
export type { Session, SessionData, SessionIdStorageStrategy, SessionStorage, FlashSessionData, } from "./lib/server-runtime/sessions"; | ||
/** @internal */ | ||
export { DataRouterContext as UNSAFE_DataRouterContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RouteContext as UNSAFE_RouteContext, mapRouteProperties as UNSAFE_mapRouteProperties, useRouteId as UNSAFE_useRouteId, useRoutesImpl as UNSAFE_useRoutesImpl, }; | ||
export { createBrowserHistory as UNSAFE_createBrowserHistory, invariant as UNSAFE_invariant, } from "./lib/router/history"; | ||
/** @internal */ | ||
export { createRouter as UNSAFE_createRouter } from "./lib/router/router"; | ||
/** @internal */ | ||
export { ErrorResponseImpl as UNSAFE_ErrorResponseImpl } from "./lib/router/utils"; | ||
/** @internal */ | ||
export { DataRouterContext as UNSAFE_DataRouterContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, FetchersContext as UNSAFE_FetchersContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RouteContext as UNSAFE_RouteContext, ViewTransitionContext as UNSAFE_ViewTransitionContext, } from "./lib/context"; | ||
/** @internal */ | ||
export { mapRouteProperties as UNSAFE_mapRouteProperties } from "./lib/components"; | ||
/** @internal */ | ||
export { FrameworkContext as UNSAFE_FrameworkContext } from "./lib/dom/ssr/components"; | ||
/** @internal */ | ||
export type { AssetsManifest as UNSAFE_AssetsManifest } from "./lib/dom/ssr/entry"; | ||
/** @internal */ | ||
export { deserializeErrors as UNSAFE_deserializeErrors } from "./lib/dom/ssr/errors"; | ||
/** @internal */ | ||
export { RemixErrorBoundary as UNSAFE_RemixErrorBoundary } from "./lib/dom/ssr/errorBoundaries"; | ||
/** @internal */ | ||
export { getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, } from "./lib/dom/ssr/fog-of-war"; | ||
/** @internal */ | ||
export type { RouteModules as UNSAFE_RouteModules } from "./lib/dom/ssr/routeModules"; | ||
/** @internal */ | ||
export { createClientRoutes as UNSAFE_createClientRoutes, createClientRoutesWithHMRRevalidationOptOut as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, shouldHydrateRouteLoader as UNSAFE_shouldHydrateRouteLoader, } from "./lib/dom/ssr/routes"; | ||
/** @internal */ | ||
export { getSingleFetchDataStrategy as UNSAFE_getSingleFetchDataStrategy } from "./lib/dom/ssr/single-fetch"; | ||
/** @internal */ | ||
export { decodeViaTurboStream as UNSAFE_decodeViaTurboStream, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, } from "./lib/dom/ssr/single-fetch"; | ||
/** @internal */ | ||
export { ServerMode as UNSAFE_ServerMode } from "./lib/server-runtime/mode"; | ||
/** @internal */ | ||
export { useScrollRestoration as UNSAFE_useScrollRestoration } from "./lib/dom/lib"; |
@@ -1,13 +0,28 @@ | ||
import type { InitialEntry, LazyRouteFunction, Location, RelativeRoutingType, Router as RemixRouter, To, TrackedPromise } from "@remix-run/router"; | ||
import { Action as NavigationType } from "@remix-run/router"; | ||
import * as React from "react"; | ||
import type { IndexRouteObject, Navigator, NonIndexRouteObject, RouteMatch, RouteObject } from "./context"; | ||
export interface FutureConfig { | ||
v7_relativeSplatPath: boolean; | ||
v7_startTransition: boolean; | ||
} | ||
import type { InitialEntry, Location, To } from "./router/history"; | ||
import { Action as NavigationType } from "./router/history"; | ||
import type { FutureConfig, HydrationState, RelativeRoutingType, Router as DataRouter } from "./router/router"; | ||
import type { DataStrategyFunction, LazyRouteFunction } from "./router/utils"; | ||
import type { IndexRouteObject, Navigator, NonIndexRouteObject, PatchRoutesOnNavigationFunction, RouteMatch, RouteObject } from "./context"; | ||
/** | ||
* @private | ||
*/ | ||
export declare function mapRouteProperties(route: RouteObject): Partial<RouteObject> & { | ||
hasErrorBoundary: boolean; | ||
}; | ||
/** | ||
* @category Routers | ||
*/ | ||
export declare function createMemoryRouter(routes: RouteObject[], opts?: { | ||
basename?: string; | ||
future?: Partial<FutureConfig>; | ||
hydrationData?: HydrationState; | ||
initialEntries?: InitialEntry[]; | ||
initialIndex?: number; | ||
dataStrategy?: DataStrategyFunction; | ||
patchRoutesOnNavigation?: PatchRoutesOnNavigationFunction; | ||
}): DataRouter; | ||
export interface RouterProviderProps { | ||
fallbackElement?: React.ReactNode; | ||
router: RemixRouter; | ||
future?: Partial<Pick<FutureConfig, "v7_startTransition">>; | ||
router: DataRouter; | ||
flushSync?: (fn: () => unknown) => undefined; | ||
} | ||
@@ -17,3 +32,6 @@ /** | ||
*/ | ||
export declare function RouterProvider({ fallbackElement, router, future, }: RouterProviderProps): React.ReactElement; | ||
export declare function RouterProvider({ router, flushSync: reactDomFlushSyncImpl, }: RouterProviderProps): React.ReactElement; | ||
/** | ||
* @category Types | ||
*/ | ||
export interface MemoryRouterProps { | ||
@@ -24,3 +42,2 @@ basename?: string; | ||
initialIndex?: number; | ||
future?: Partial<FutureConfig>; | ||
} | ||
@@ -30,5 +47,8 @@ /** | ||
* | ||
* @see https://reactrouter.com/router-components/memory-router | ||
* @category Router Components | ||
*/ | ||
export declare function MemoryRouter({ basename, children, initialEntries, initialIndex, future, }: MemoryRouterProps): React.ReactElement; | ||
export declare function MemoryRouter({ basename, children, initialEntries, initialIndex, }: MemoryRouterProps): React.ReactElement; | ||
/** | ||
* @category Types | ||
*/ | ||
export interface NavigateProps { | ||
@@ -41,20 +61,48 @@ to: To; | ||
/** | ||
* Changes the current location. | ||
* A component-based version of {@link useNavigate} to use in a [`React.Component | ||
* Class`](https://reactjs.org/docs/react-component.html) where hooks are not | ||
* able to be used. | ||
* | ||
* Note: This API is mostly useful in React.Component subclasses that are not | ||
* able to use hooks. In functional components, we recommend you use the | ||
* `useNavigate` hook instead. | ||
* It's recommended to avoid using this component in favor of {@link useNavigate} | ||
* | ||
* @see https://reactrouter.com/components/navigate | ||
* @category Components | ||
*/ | ||
export declare function Navigate({ to, replace, state, relative, }: NavigateProps): null; | ||
/** | ||
* @category Types | ||
*/ | ||
export interface OutletProps { | ||
/** | ||
Provides a context value to the element tree below the outlet. Use when the parent route needs to provide values to child routes. | ||
```tsx | ||
<Outlet context={myContextValue} /> | ||
``` | ||
Access the context with {@link useOutletContext}. | ||
*/ | ||
context?: unknown; | ||
} | ||
/** | ||
* Renders the child route's element, if there is one. | ||
* | ||
* @see https://reactrouter.com/components/outlet | ||
Renders the matching child route of a parent route or nothing if no child route matches. | ||
```tsx | ||
import { Outlet } from "react-router" | ||
export default function SomeParent() { | ||
return ( | ||
<div> | ||
<h1>Parent Content</h1> | ||
<Outlet /> | ||
</div> | ||
); | ||
} | ||
``` | ||
@category Components | ||
*/ | ||
export declare function Outlet(props: OutletProps): React.ReactElement | null; | ||
/** | ||
* @category Types | ||
*/ | ||
export interface PathRouteProps { | ||
@@ -79,4 +127,10 @@ caseSensitive?: NonIndexRouteObject["caseSensitive"]; | ||
} | ||
/** | ||
* @category Types | ||
*/ | ||
export interface LayoutRouteProps extends PathRouteProps { | ||
} | ||
/** | ||
* @category Types | ||
*/ | ||
export interface IndexRouteProps { | ||
@@ -103,7 +157,13 @@ caseSensitive?: IndexRouteObject["caseSensitive"]; | ||
/** | ||
* Declares an element that should be rendered at a certain URL path. | ||
* Configures an element to render when a pattern matches the current location. | ||
* It must be rendered within a {@link Routes} element. Note that these routes | ||
* do not participate in data loading, actions, code splitting, or any other | ||
* route module features. | ||
* | ||
* @see https://reactrouter.com/components/route | ||
* @category Components | ||
*/ | ||
export declare function Route(_props: RouteProps): React.ReactElement | null; | ||
/** | ||
* @category Types | ||
*/ | ||
export interface RouterProps { | ||
@@ -116,3 +176,2 @@ basename?: string; | ||
static?: boolean; | ||
future?: Partial<Pick<FutureConfig, "v7_relativeSplatPath">>; | ||
} | ||
@@ -126,29 +185,183 @@ /** | ||
* | ||
* @see https://reactrouter.com/router-components/router | ||
* @category Components | ||
*/ | ||
export declare function Router({ basename: basenameProp, children, location: locationProp, navigationType, navigator, static: staticProp, future, }: RouterProps): React.ReactElement | null; | ||
export declare function Router({ basename: basenameProp, children, location: locationProp, navigationType, navigator, static: staticProp, }: RouterProps): React.ReactElement | null; | ||
/** | ||
* @category Types | ||
*/ | ||
export interface RoutesProps { | ||
/** | ||
* Nested {@link Route} elements | ||
*/ | ||
children?: React.ReactNode; | ||
/** | ||
* The location to match against. Defaults to the current location. | ||
*/ | ||
location?: Partial<Location> | string; | ||
} | ||
/** | ||
* A container for a nested tree of `<Route>` elements that renders the branch | ||
* that best matches the current location. | ||
* | ||
* @see https://reactrouter.com/components/routes | ||
Renders a branch of {@link Route | `<Routes>`} that best matches the current | ||
location. Note that these routes do not participate in data loading, actions, | ||
code splitting, or any other route module features. | ||
```tsx | ||
import { Routes, Route } from "react-router" | ||
<Routes> | ||
<Route index element={<StepOne />} /> | ||
<Route path="step-2" element={<StepTwo />} /> | ||
<Route path="step-3" element={<StepThree />}> | ||
</Routes> | ||
``` | ||
@category Components | ||
*/ | ||
export declare function Routes({ children, location, }: RoutesProps): React.ReactElement | null; | ||
export interface AwaitResolveRenderFunction { | ||
(data: Awaited<any>): React.ReactNode; | ||
export interface AwaitResolveRenderFunction<Resolve = any> { | ||
(data: Awaited<Resolve>): React.ReactNode; | ||
} | ||
export interface AwaitProps { | ||
/** | ||
* @category Types | ||
*/ | ||
export interface AwaitProps<Resolve> { | ||
/** | ||
When using a function, the resolved value is provided as the parameter. | ||
```tsx [2] | ||
<Await resolve={reviewsPromise}> | ||
{(resolvedReviews) => <Reviews items={resolvedReviews} />} | ||
</Await> | ||
``` | ||
When using React elements, {@link useAsyncValue} will provide the | ||
resolved value: | ||
```tsx [2] | ||
<Await resolve={reviewsPromise}> | ||
<Reviews /> | ||
</Await> | ||
function Reviews() { | ||
const resolvedReviews = useAsyncValue() | ||
return <div>...</div> | ||
} | ||
``` | ||
*/ | ||
children: React.ReactNode | AwaitResolveRenderFunction; | ||
/** | ||
The error element renders instead of the children when the promise rejects. | ||
```tsx | ||
<Await | ||
errorElement={<div>Oops</div>} | ||
resolve={reviewsPromise} | ||
> | ||
<Reviews /> | ||
</Await> | ||
``` | ||
To provide a more contextual error, you can use the {@link useAsyncError} in a | ||
child component | ||
```tsx | ||
<Await | ||
errorElement={<ReviewsError />} | ||
resolve={reviewsPromise} | ||
> | ||
<Reviews /> | ||
</Await> | ||
function ReviewsError() { | ||
const error = useAsyncError() | ||
return <div>Error loading reviews: {error.message}</div> | ||
} | ||
``` | ||
If you do not provide an errorElement, the rejected value will bubble up to | ||
the nearest route-level {@link NonIndexRouteObject#ErrorBoundary | ErrorBoundary} and be accessible | ||
via {@link useRouteError} hook. | ||
*/ | ||
errorElement?: React.ReactNode; | ||
resolve: TrackedPromise | any; | ||
/** | ||
Takes a promise returned from a {@link LoaderFunction | loader} value to be resolved and rendered. | ||
```jsx | ||
import { useLoaderData, Await } from "react-router" | ||
export async function loader() { | ||
let reviews = getReviews() // not awaited | ||
let book = await getBook() | ||
return { | ||
book, | ||
reviews, // this is a promise | ||
} | ||
} | ||
export default function Book() { | ||
const { | ||
book, | ||
reviews, // this is the same promise | ||
} = useLoaderData() | ||
return ( | ||
<div> | ||
<h1>{book.title}</h1> | ||
<p>{book.description}</p> | ||
<React.Suspense fallback={<ReviewsSkeleton />}> | ||
<Await | ||
// and is the promise we pass to Await | ||
resolve={reviews} | ||
> | ||
<Reviews /> | ||
</Await> | ||
</React.Suspense> | ||
</div> | ||
); | ||
} | ||
``` | ||
*/ | ||
resolve: Resolve; | ||
} | ||
/** | ||
* Component to use for rendering lazily loaded data from returning defer() | ||
* in a loader function | ||
*/ | ||
export declare function Await({ children, errorElement, resolve }: AwaitProps): React.JSX.Element; | ||
Used to render promise values with automatic error handling. | ||
```tsx | ||
import { Await, useLoaderData } from "react-router"; | ||
export function loader() { | ||
// not awaited | ||
const reviews = getReviews() | ||
// awaited (blocks the transition) | ||
const book = await fetch("/api/book").then((res) => res.json()) | ||
return { book, reviews } | ||
} | ||
function Book() { | ||
const { book, reviews } = useLoaderData(); | ||
return ( | ||
<div> | ||
<h1>{book.title}</h1> | ||
<p>{book.description}</p> | ||
<React.Suspense fallback={<ReviewsSkeleton />}> | ||
<Await | ||
resolve={reviews} | ||
errorElement={ | ||
<div>Could not load reviews 😬</div> | ||
} | ||
children={(resolvedReviews) => ( | ||
<Reviews items={resolvedReviews} /> | ||
)} | ||
/> | ||
</React.Suspense> | ||
</div> | ||
); | ||
} | ||
``` | ||
**Note:** `<Await>` expects to be rendered inside of a `<React.Suspense>` | ||
@category Components | ||
*/ | ||
export declare function Await<Resolve>({ children, errorElement, resolve, }: AwaitProps<Resolve>): React.JSX.Element; | ||
/** | ||
@@ -159,3 +372,3 @@ * Creates a route config from a React "children" object, which is usually | ||
* | ||
* @see https://reactrouter.com/utils/create-routes-from-children | ||
* @category Utils | ||
*/ | ||
@@ -165,3 +378,5 @@ export declare function createRoutesFromChildren(children: React.ReactNode, parentPath?: number[]): RouteObject[]; | ||
* Renders the result of `matchRoutes()` into a React element. | ||
* | ||
* @category Utils | ||
*/ | ||
export declare function renderMatches(matches: RouteMatch[] | null): React.ReactElement | null; |
import * as React from "react"; | ||
import type { AgnosticIndexRouteObject, AgnosticNonIndexRouteObject, AgnosticRouteMatch, History, LazyRouteFunction, Location, Action as NavigationType, RelativeRoutingType, Router, StaticHandlerContext, To, TrackedPromise } from "@remix-run/router"; | ||
import type { History, Action as NavigationType, Location, To } from "./router/history"; | ||
import type { RelativeRoutingType, Router, StaticHandlerContext } from "./router/router"; | ||
import type { AgnosticIndexRouteObject, AgnosticNonIndexRouteObject, AgnosticPatchRoutesOnNavigationFunction, AgnosticPatchRoutesOnNavigationFunctionArgs, AgnosticRouteMatch, LazyRouteFunction, TrackedPromise } from "./router/utils"; | ||
export interface IndexRouteObject { | ||
@@ -50,2 +52,4 @@ caseSensitive?: AgnosticIndexRouteObject["caseSensitive"]; | ||
} | ||
export type PatchRoutesOnNavigationFunctionArgs = AgnosticPatchRoutesOnNavigationFunctionArgs<RouteObject, RouteMatch>; | ||
export type PatchRoutesOnNavigationFunction = AgnosticPatchRoutesOnNavigationFunction<RouteObject, RouteMatch>; | ||
export interface DataRouterContextObject extends Omit<NavigationContextObject, "future"> { | ||
@@ -56,3 +60,14 @@ router: Router; | ||
export declare const DataRouterContext: React.Context<DataRouterContextObject | null>; | ||
export declare const DataRouterStateContext: React.Context<import("@remix-run/router").RouterState | null>; | ||
export declare const DataRouterStateContext: React.Context<import("./router/router").RouterState | null>; | ||
export type ViewTransitionContextObject = { | ||
isTransitioning: false; | ||
} | { | ||
isTransitioning: true; | ||
flushSync: boolean; | ||
currentLocation: Location; | ||
nextLocation: Location; | ||
}; | ||
export declare const ViewTransitionContext: React.Context<ViewTransitionContextObject>; | ||
export type FetchersContextObject = Map<string, any>; | ||
export declare const FetchersContext: React.Context<FetchersContextObject>; | ||
export declare const AwaitContext: React.Context<TrackedPromise | null>; | ||
@@ -64,4 +79,4 @@ export interface NavigateOptions { | ||
relative?: RelativeRoutingType; | ||
unstable_flushSync?: boolean; | ||
unstable_viewTransition?: boolean; | ||
flushSync?: boolean; | ||
viewTransition?: boolean; | ||
} | ||
@@ -88,5 +103,3 @@ /** | ||
static: boolean; | ||
future: { | ||
v7_relativeSplatPath: boolean; | ||
}; | ||
future: {}; | ||
} | ||
@@ -93,0 +106,0 @@ export declare const NavigationContext: React.Context<NavigationContextObject>; |
import * as React from "react"; | ||
import type { Blocker, BlockerFunction, Location, ParamParseKey, Params, Path, PathMatch, PathPattern, RelativeRoutingType, Router as RemixRouter, RevalidationState, To, UIMatch } from "@remix-run/router"; | ||
import { Action as NavigationType } from "@remix-run/router"; | ||
import type { NavigateOptions, RouteContextObject, RouteMatch, RouteObject } from "./context"; | ||
import type { Location, Path, To } from "./router/history"; | ||
import { Action as NavigationType } from "./router/history"; | ||
import type { Blocker, BlockerFunction, RelativeRoutingType, Router as DataRouter, RevalidationState } from "./router/router"; | ||
import type { ParamParseKey, Params, PathMatch, PathPattern, UIMatch } from "./router/utils"; | ||
import type { DeprecatedSerializeFrom } from "./types"; | ||
/** | ||
* Returns the full href for the given "to" value. This is useful for building | ||
* custom links that are also accessible and preserve right-click behavior. | ||
* | ||
* @see https://reactrouter.com/hooks/use-href | ||
Resolves a URL against the current location. | ||
```tsx | ||
import { useHref } from "react-router" | ||
function SomeComponent() { | ||
let href = useHref("some/where"); | ||
// "/resolved/some/where" | ||
} | ||
``` | ||
@category Hooks | ||
*/ | ||
@@ -15,16 +26,30 @@ export declare function useHref(to: To, { relative }?: { | ||
/** | ||
* Returns true if this component is a descendant of a `<Router>`. | ||
* Returns true if this component is a descendant of a Router, useful to ensure | ||
* a component is used within a Router. | ||
* | ||
* @see https://reactrouter.com/hooks/use-in-router-context | ||
* @category Hooks | ||
*/ | ||
export declare function useInRouterContext(): boolean; | ||
/** | ||
* Returns the current location object, which represents the current URL in web | ||
* browsers. | ||
* | ||
* Note: If you're using this it may mean you're doing some of your own | ||
* "routing" in your app, and we'd like to know what your use case is. We may | ||
* be able to provide something higher-level to better suit your needs. | ||
* | ||
* @see https://reactrouter.com/hooks/use-location | ||
Returns the current {@link Location}. This can be useful if you'd like to perform some side effect whenever it changes. | ||
```tsx | ||
import * as React from 'react' | ||
import { useLocation } from 'react-router' | ||
function SomeComponent() { | ||
let location = useLocation() | ||
React.useEffect(() => { | ||
// Google Analytics | ||
ga('send', 'pageview') | ||
}, [location]); | ||
return ( | ||
// ... | ||
); | ||
} | ||
``` | ||
@category Hooks | ||
*/ | ||
@@ -36,3 +61,3 @@ export declare function useLocation(): Location; | ||
* | ||
* @see https://reactrouter.com/hooks/use-navigation-type | ||
* @category Hooks | ||
*/ | ||
@@ -45,3 +70,3 @@ export declare function useNavigationType(): NavigationType; | ||
* | ||
* @see https://reactrouter.com/hooks/use-match | ||
* @category Hooks | ||
*/ | ||
@@ -53,16 +78,32 @@ export declare function useMatch<ParamKey extends ParamParseKey<Path>, Path extends string>(pattern: PathPattern<Path> | Path): PathMatch<ParamKey> | null; | ||
export interface NavigateFunction { | ||
(to: To, options?: NavigateOptions): void; | ||
(delta: number): void; | ||
(to: To, options?: NavigateOptions): void | Promise<void>; | ||
(delta: number): void | Promise<void>; | ||
} | ||
/** | ||
* Returns an imperative method for changing the location. Used by `<Link>`s, but | ||
* may also be used by other elements to change the location. | ||
* | ||
* @see https://reactrouter.com/hooks/use-navigate | ||
Returns a function that lets you navigate programmatically in the browser in response to user interactions or effects. | ||
```tsx | ||
import { useNavigate } from "react-router"; | ||
function SomeComponent() { | ||
let navigate = useNavigate(); | ||
return ( | ||
<button | ||
onClick={() => { | ||
navigate(-1); | ||
}} | ||
/> | ||
); | ||
} | ||
``` | ||
It's often better to use {@link redirect} in {@link ActionFunction | actions} and {@link LoaderFunction | loaders} than this hook. | ||
@category Hooks | ||
*/ | ||
export declare function useNavigate(): NavigateFunction; | ||
/** | ||
* Returns the context (if provided) for the child route at this level of the route | ||
* hierarchy. | ||
* @see https://reactrouter.com/hooks/use-outlet-context | ||
* Returns the parent route {@link OutletProps.context | `<Outlet context>`}. | ||
* | ||
* @category Hooks | ||
*/ | ||
@@ -74,10 +115,20 @@ export declare function useOutletContext<Context = unknown>(): Context; | ||
* | ||
* @see https://reactrouter.com/hooks/use-outlet | ||
* @category Hooks | ||
*/ | ||
export declare function useOutlet(context?: unknown): React.ReactElement | null; | ||
/** | ||
* Returns an object of key/value pairs of the dynamic params from the current | ||
* URL that were matched by the route path. | ||
* | ||
* @see https://reactrouter.com/hooks/use-params | ||
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. | ||
```tsx | ||
import { useParams } from "react-router" | ||
function SomeComponent() { | ||
let params = useParams() | ||
params.postId | ||
} | ||
``` | ||
Assuming a route pattern like `/posts/:postId` is matched by `/posts/123` then `params.postId` will be `"123"`. | ||
@category Hooks | ||
*/ | ||
@@ -88,5 +139,17 @@ export declare function useParams<ParamsOrKey extends string | Record<string, string | undefined> = string>(): Readonly<[ | ||
/** | ||
* Resolves the pathname of the given `to` value against the current location. | ||
* | ||
* @see https://reactrouter.com/hooks/use-resolved-path | ||
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. | ||
```tsx | ||
import { useResolvedPath } from "react-router" | ||
function SomeComponent() { | ||
// if the user is at /dashboard/profile | ||
let path = useResolvedPath("../accounts") | ||
path.pathname // "/dashboard/accounts" | ||
path.search // "" | ||
path.hash // "" | ||
} | ||
``` | ||
@category Hooks | ||
*/ | ||
@@ -97,11 +160,40 @@ export declare function useResolvedPath(to: To, { relative }?: { | ||
/** | ||
* Returns the element of the route that matched the current location, prepared | ||
* with the correct context to render the remainder of the route tree. Route | ||
* elements in the tree must render an `<Outlet>` to render their child route's | ||
* element. | ||
Hook version of {@link Routes | `<Routes>`} that uses objects instead of components. These objects have the same properties as the component props. | ||
The return value of `useRoutes` is either a valid React element you can use to render the route tree, or `null` if nothing matched. | ||
```tsx | ||
import * as React from "react"; | ||
import { useRoutes } from "react-router"; | ||
function App() { | ||
let element = useRoutes([ | ||
{ | ||
path: "/", | ||
element: <Dashboard />, | ||
children: [ | ||
{ | ||
path: "messages", | ||
element: <DashboardMessages />, | ||
}, | ||
{ path: "tasks", element: <DashboardTasks /> }, | ||
], | ||
}, | ||
{ path: "team", element: <AboutPage /> }, | ||
]); | ||
return element; | ||
} | ||
``` | ||
@category Hooks | ||
*/ | ||
export declare function useRoutes(routes: RouteObject[], locationArg?: Partial<Location> | string): React.ReactElement | null; | ||
/** | ||
* Internal implementation with accept optional param for RouterProvider usage | ||
* | ||
* @see https://reactrouter.com/hooks/use-routes | ||
* @private | ||
* @category Hooks | ||
*/ | ||
export declare function useRoutes(routes: RouteObject[], locationArg?: Partial<Location> | string): React.ReactElement | null; | ||
export declare function useRoutesImpl(routes: RouteObject[], locationArg?: Partial<Location> | string, dataRouterState?: RemixRouter["state"], future?: RemixRouter["future"]): React.ReactElement | null; | ||
export declare function useRoutesImpl(routes: RouteObject[], locationArg?: Partial<Location> | string, dataRouterState?: DataRouter["state"], future?: DataRouter["future"]): React.ReactElement | null; | ||
type RenderErrorBoundaryProps = React.PropsWithChildren<{ | ||
@@ -132,3 +224,3 @@ location: Location; | ||
} | ||
export declare function _renderMatches(matches: RouteMatch[] | null, parentMatches?: RouteMatch[], dataRouterState?: RemixRouter["state"] | null, future?: RemixRouter["future"] | null): React.ReactElement | null; | ||
export declare function _renderMatches(matches: RouteMatch[] | null, parentMatches?: RouteMatch[], dataRouterState?: DataRouter["state"] | null, future?: DataRouter["future"] | null): React.ReactElement | null; | ||
/** | ||
@@ -139,12 +231,45 @@ * Returns the ID for the nearest contextual route | ||
/** | ||
* Returns the current navigation, defaulting to an "idle" navigation when | ||
* no navigation is in progress | ||
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. | ||
```tsx | ||
import { useNavigation } from "react-router" | ||
function SomeComponent() { | ||
let navigation = useNavigation(); | ||
navigation.state | ||
navigation.formData | ||
// etc. | ||
} | ||
``` | ||
@category Hooks | ||
*/ | ||
export declare function useNavigation(): import("@remix-run/router").Navigation; | ||
export declare function useNavigation(): import("./router/router").Navigation; | ||
/** | ||
* Returns a revalidate function for manually triggering revalidation, as well | ||
* as the current state of any manual revalidations | ||
Revalidate the data on the page for reasons outside of normal data mutations like window focus or polling on an interval. | ||
```tsx | ||
import { useRevalidator } from "react-router"; | ||
function WindowFocusRevalidator() { | ||
const revalidator = useRevalidator(); | ||
useFakeWindowFocus(() => { | ||
revalidator.revalidate(); | ||
}); | ||
return ( | ||
<div hidden={revalidator.state === "idle"}> | ||
Revalidating... | ||
</div> | ||
); | ||
} | ||
``` | ||
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. | ||
@category Hooks | ||
*/ | ||
export declare function useRevalidator(): { | ||
revalidate: () => void; | ||
revalidate(): Promise<void>; | ||
state: RevalidationState; | ||
@@ -155,28 +280,131 @@ }; | ||
* parent/child routes or the route "handle" property | ||
* | ||
* @category Hooks | ||
*/ | ||
export declare function useMatches(): UIMatch[]; | ||
/** | ||
* Returns the loader data for the nearest ancestor Route loader | ||
Returns the data from the closest route {@link LoaderFunction | loader} or {@link ClientLoaderFunction | client loader}. | ||
```tsx | ||
import { useLoaderData } from "react-router" | ||
export async function loader() { | ||
return await fakeDb.invoices.findAll(); | ||
} | ||
export default function Invoices() { | ||
let invoices = useLoaderData<typeof loader>(); | ||
// ... | ||
} | ||
``` | ||
@category Hooks | ||
*/ | ||
export declare function useLoaderData(): unknown; | ||
export declare function useLoaderData<T = any>(): DeprecatedSerializeFrom<T>; | ||
/** | ||
* Returns the loaderData for the given routeId | ||
Returns the loader data for a given route by route ID. | ||
```tsx | ||
import { useRouteLoaderData } from "react-router"; | ||
function SomeComponent() { | ||
const { user } = useRouteLoaderData("root"); | ||
} | ||
``` | ||
Route IDs are created automatically. They are simply the path of the route file relative to the app folder without the extension. | ||
| Route Filename | Route ID | | ||
| -------------------------- | -------------------- | | ||
| `app/root.tsx` | `"root"` | | ||
| `app/routes/teams.tsx` | `"routes/teams"` | | ||
| `app/whatever/teams.$id.tsx` | `"whatever/teams.$id"` | | ||
If you created an ID manually, you can use that instead: | ||
```tsx | ||
route("/", "containers/app.tsx", { id: "app" }}) | ||
``` | ||
@category Hooks | ||
*/ | ||
export declare function useRouteLoaderData(routeId: string): unknown; | ||
export declare function useRouteLoaderData<T = any>(routeId: string): DeprecatedSerializeFrom<T> | undefined; | ||
/** | ||
* Returns the action data for the nearest ancestor Route action | ||
Returns the action data from the most recent POST navigation form submission or `undefined` if there hasn't been one. | ||
```tsx | ||
import { Form, useActionData } from "react-router" | ||
export async function action({ request }) { | ||
const body = await request.formData() | ||
const name = body.get("visitorsName") | ||
return { message: `Hello, ${name}` } | ||
} | ||
export default function Invoices() { | ||
const data = useActionData() | ||
return ( | ||
<Form method="post"> | ||
<input type="text" name="visitorsName" /> | ||
{data ? data.message : "Waiting..."} | ||
</Form> | ||
) | ||
} | ||
``` | ||
@category Hooks | ||
*/ | ||
export declare function useActionData(): unknown; | ||
export declare function useActionData<T = any>(): DeprecatedSerializeFrom<T> | undefined; | ||
/** | ||
* Returns the nearest ancestor Route error, which could be a loader/action | ||
* error or a render error. This is intended to be called from your | ||
* ErrorBoundary/errorElement to display a proper error message. | ||
Accesses the error thrown during an {@link ActionFunction | action}, {@link LoaderFunction | loader}, or component render to be used in a route module Error Boundary. | ||
```tsx | ||
export function ErrorBoundary() { | ||
const error = useRouteError(); | ||
return <div>{error.message}</div>; | ||
} | ||
``` | ||
@category Hooks | ||
*/ | ||
export declare function useRouteError(): unknown; | ||
/** | ||
* Returns the happy-path data from the nearest ancestor `<Await />` value | ||
Returns the resolved promise value from the closest {@link Await | `<Await>`}. | ||
```tsx | ||
function SomeDescendant() { | ||
const value = useAsyncValue(); | ||
// ... | ||
} | ||
// somewhere in your app | ||
<Await resolve={somePromise}> | ||
<SomeDescendant /> | ||
</Await> | ||
``` | ||
@category Hooks | ||
*/ | ||
export declare function useAsyncValue(): unknown; | ||
/** | ||
* Returns the error from the nearest ancestor `<Await />` value | ||
Returns the rejection value from the closest {@link Await | `<Await>`}. | ||
```tsx | ||
import { Await, useAsyncError } from "react-router" | ||
function ErrorElement() { | ||
const error = useAsyncError(); | ||
return ( | ||
<p>Uh Oh, something went wrong! {error.message}</p> | ||
); | ||
} | ||
// somewhere in your app | ||
<Await | ||
resolve={promiseThatRejects} | ||
errorElement={<ErrorElement />} | ||
/> | ||
``` | ||
@category Hooks | ||
*/ | ||
@@ -189,4 +417,6 @@ export declare function useAsyncError(): unknown; | ||
* cross-origin navigations. | ||
* | ||
* @category Hooks | ||
*/ | ||
export declare function useBlocker(shouldBlock: boolean | BlockerFunction): Blocker; | ||
export {}; |
/** | ||
* React Router v0.0.0-experimental-7c2094e9e | ||
* React Router v0.0.0-experimental-7c6c0664d | ||
* | ||
@@ -4,0 +4,0 @@ * Copyright (c) Remix Software Inc. |
{ | ||
"name": "react-router", | ||
"version": "0.0.0-experimental-7c2094e9e", | ||
"version": "0.0.0-experimental-7c6c0664d", | ||
"description": "Declarative routing for React", | ||
@@ -23,14 +23,43 @@ "keywords": [ | ||
"unpkg": "./dist/umd/react-router.production.min.js", | ||
"module": "./dist/index.js", | ||
"module": "./dist/index.mjs", | ||
"types": "./dist/index.d.ts", | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/main.js" | ||
}, | ||
"./types": { | ||
"types": "./dist/lib/types.d.ts" | ||
}, | ||
"./dom": { | ||
"types": "./dist/dom-export.d.ts", | ||
"import": "./dist/dom-export.mjs", | ||
"require": "./dist/main-dom-export.js" | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"dependencies": { | ||
"@remix-run/router": "0.0.0-experimental-7c2094e9e" | ||
"@types/cookie": "^0.6.0", | ||
"@web3-storage/multipart-parser": "^1.0.0", | ||
"cookie": "^1.0.1", | ||
"set-cookie-parser": "^2.6.0", | ||
"source-map": "^0.7.3", | ||
"turbo-stream": "2.4.0", | ||
"react-router": "0.0.0-experimental-7c6c0664d" | ||
}, | ||
"devDependencies": { | ||
"@types/set-cookie-parser": "^2.4.1", | ||
"react": "^18.2.0", | ||
"react-router-dom": "0.0.0-experimental-7c2094e9e" | ||
"react-dom": "^18.2.0" | ||
}, | ||
"peerDependencies": { | ||
"react": ">=16.8" | ||
"react": ">=18", | ||
"react-dom": ">=18" | ||
}, | ||
"peerDependenciesMeta": { | ||
"react-dom": { | ||
"optional": true | ||
} | ||
}, | ||
"files": [ | ||
@@ -43,4 +72,4 @@ "dist/", | ||
"engines": { | ||
"node": ">=14.0.0" | ||
"node": ">=20.0.0" | ||
} | ||
} |
# React Router | ||
The `react-router` package is the heart of [React Router](https://github.com/remix-run/react-router) and provides all | ||
the core functionality for both | ||
[`react-router-dom`](https://github.com/remix-run/react-router/tree/main/packages/react-router-dom) | ||
and | ||
[`react-router-native`](https://github.com/remix-run/react-router/tree/main/packages/react-router-native). | ||
If you're using React Router, you should never `import` anything directly from | ||
the `react-router` package, but you should have everything you need in either | ||
`react-router-dom` or `react-router-native`. Both of those packages re-export | ||
everything from `react-router`. | ||
If you'd like to extend React Router and you know what you're doing, you should | ||
add `react-router` **as a peer dependency, not a regular dependency** in your | ||
package. | ||
The `react-router` package is the heart of [React Router](https://github.com/remix-run/react-router) and provides all the core functionality. |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
6516294
81
41963
9
3
4
4
94
14
+ Added@types/cookie@^0.6.0
+ Addedcookie@^1.0.1
+ Addedset-cookie-parser@^2.6.0
+ Addedsource-map@^0.7.3
+ Addedturbo-stream@2.4.0
+ Added@types/cookie@0.6.0(transitive)
+ Added@web3-storage/multipart-parser@1.0.0(transitive)
+ Addedcookie@1.0.2(transitive)
+ Addedreact-dom@18.3.1(transitive)
+ Addedscheduler@0.23.2(transitive)
+ Addedset-cookie-parser@2.7.1(transitive)
+ Addedsource-map@0.7.4(transitive)
+ Addedturbo-stream@2.4.0(transitive)
- Removed@remix-run/router@0.0.0-experimental-7c2094e9e(transitive)