UNPKG

4.3 kBTypeScriptView Raw
1import * as React from "react";
2import { MemoryRouter, Navigate, Outlet, Route, Router, Routes, createRoutesFromChildren, generatePath, matchRoutes, matchPath, resolvePath, renderMatches, useHref, useInRouterContext, useLocation, useMatch, useNavigate, useNavigationType, useOutlet, useParams, useResolvedPath, useRoutes } from "./react-router-index";
3import type { To } from "./react-router-index";
4export { MemoryRouter, Navigate, Outlet, Route, Router, Routes, createRoutesFromChildren, generatePath, matchRoutes, matchPath, renderMatches, resolvePath, useHref, useInRouterContext, useLocation, useMatch, useNavigate, useNavigationType, useOutlet, useParams, useResolvedPath, useRoutes };
5export type { Location, Path, To, NavigationType, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigator, OutletProps, Params, PathMatch, RouteMatch, RouteObject, RouteProps, PathRouteProps, LayoutRouteProps, IndexRouteProps, RouterProps, RoutesProps } from "./react-router-index";
6/** @internal */
7export { UNSAFE_NavigationContext, UNSAFE_LocationContext, UNSAFE_RouteContext } from "./react-router-index";
8export interface BrowserRouterProps {
9 basename?: string;
10 children?: React.ReactNode;
11 window?: Window;
12}
13/**
14 * A <Router> for use in web browsers. Provides the cleanest URLs.
15 */
16export declare function BrowserRouter({ basename, children, window }: BrowserRouterProps): JSX.Element;
17export interface HashRouterProps {
18 basename?: string;
19 children?: React.ReactNode;
20 window?: Window;
21}
22/**
23 * A <Router> for use in web browsers. Stores the location in the hash
24 * portion of the URL so it is not sent to the server.
25 */
26export declare function HashRouter({ basename, children, window }: HashRouterProps): JSX.Element;
27export interface LinkProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href"> {
28 reloadDocument?: boolean;
29 replace?: boolean;
30 state?: any;
31 to: To;
32}
33/**
34 * The public API for rendering a history-aware <a>.
35 */
36export declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
37export interface NavLinkProps extends Omit<LinkProps, "className" | "style"> {
38 caseSensitive?: boolean;
39 className?: string | ((props: {
40 isActive: boolean;
41 }) => string);
42 end?: boolean;
43 style?: React.CSSProperties | ((props: {
44 isActive: boolean;
45 }) => React.CSSProperties);
46}
47/**
48 * A <Link> wrapper that knows if it's "active" or not.
49 */
50export declare const NavLink: React.ForwardRefExoticComponent<NavLinkProps & React.RefAttributes<HTMLAnchorElement>>;
51/**
52 * Handles the click behavior for router `<Link>` components. This is useful if
53 * you need to create custom `<Link>` components with the same click behavior we
54 * use in our exported `<Link>`.
55 */
56export declare function useLinkClickHandler<E extends Element = HTMLAnchorElement>(to: To, { target, replace: replaceProp, state }?: {
57 target?: React.HTMLAttributeAnchorTarget;
58 replace?: boolean;
59 state?: any;
60}): (event: React.MouseEvent<E, MouseEvent>) => void;
61/**
62 * A convenient wrapper for reading and writing search parameters via the
63 * URLSearchParams interface.
64 */
65export declare function useSearchParams(defaultInit?: URLSearchParamsInit): readonly [URLSearchParams, (nextInit: URLSearchParamsInit, navigateOptions?: {
66 replace?: boolean | undefined;
67 state?: any;
68} | undefined) => void];
69export declare type ParamKeyValuePair = [string, string];
70export declare type URLSearchParamsInit = string | ParamKeyValuePair[] | Record<string, string | string[]> | URLSearchParams;
71/**
72 * Creates a URLSearchParams object using the given initializer.
73 *
74 * This is identical to `new URLSearchParams(init)` except it also
75 * supports arrays as values in the object form of the initializer
76 * instead of just strings. This is convenient when you need multiple
77 * values for a given key, but don't want to use an array initializer.
78 *
79 * For example, instead of:
80 *
81 * let searchParams = new URLSearchParams([
82 * ['sort', 'name'],
83 * ['sort', 'price']
84 * ]);
85 *
86 * you can do:
87 *
88 * let searchParams = createSearchParams({
89 * sort: ['name', 'price']
90 * });
91 */
92export declare function createSearchParams(init?: URLSearchParamsInit): URLSearchParams;
\No newline at end of file