@types/reach__router

  • Version 1.3.15
  • Published
  • 8.69 kB
  • 1 dependency
  • MIT license

Install

npm i @types/reach__router
yarn add @types/reach__router
pnpm add @types/reach__router

Overview

TypeScript definitions for @reach/router

Index

Variables

variable globalHistory

const globalHistory: History;
    const navigate: NavigateFn;

      Functions

      function createHistory

      createHistory: (source: HistorySource) => History;

        function createMemorySource

        createMemorySource: (initialPath: string) => HistorySource;

          function isRedirect

          isRedirect: (error: any) => error is RedirectRequest;
            Link: <TState>(
            props: React.PropsWithoutRef<LinkProps<TState>> &
            React.RefAttributes<HTMLAnchorElement>
            ) => ReturnType<Link<TState>>;

              function redirectTo

              redirectTo: (uri: string) => void;

                function useLocation

                useLocation: () => WindowLocation;

                  function useMatch

                  useMatch: (pathname: string) => {
                  [param: string]: string;
                  uri: string;
                  path: string;
                  };

                    function useNavigate

                    useNavigate: () => NavigateFn;

                      function useParams

                      useParams: <
                      TParams extends { [Param in keyof TParams]?: string } = any
                      >() => TParams;

                        Classes

                        class Location

                        class Location extends React.Component<LocationProps> {}

                          class LocationProvider

                          class LocationProvider extends React.Component<LocationProviderProps> {}

                            class Match

                            class Match<TParams> extends React.Component<MatchProps<TParams>> {}

                              class Redirect

                              class Redirect<TState> extends React.Component<
                              RouteComponentProps<RedirectProps<TState>>
                              > {}

                                class Router

                                class Router extends React.Component<
                                RouterProps & React.HTMLProps<HTMLDivElement>
                                > {}

                                  class ServerLocation

                                  class ServerLocation extends React.Component<ServerLocationProps> {}

                                    Interfaces

                                    interface History

                                    interface History {}

                                      property listen

                                      listen: (listener: HistoryListener) => HistoryUnsubscribe;

                                        property location

                                        readonly location: HistoryLocation;

                                          property navigate

                                          navigate: NavigateFn;

                                            property transitioning

                                            readonly transitioning: boolean;

                                              interface HistoryListenerParameter

                                              interface HistoryListenerParameter {}

                                                property action

                                                action: HistoryActionType;

                                                  property location

                                                  location: HistoryLocation;

                                                    interface HistorySource

                                                    interface HistorySource {}

                                                      property history

                                                      history: {
                                                      readonly state: any;
                                                      pushState(state: any, title: string, uri: string): void;
                                                      replaceState(state: any, title: string, uri: string): void;
                                                      };

                                                        property location

                                                        readonly location: WindowLocation;

                                                          method addEventListener

                                                          addEventListener: (name: string, listener: (event: Event) => void) => void;

                                                            method removeEventListener

                                                            removeEventListener: (name: string, listener: (event: Event) => void) => void;

                                                              interface HLocation

                                                              interface HLocation<S = unknown> {}

                                                                property hash

                                                                hash: string;

                                                                  property key

                                                                  key?: string | undefined;

                                                                    property pathname

                                                                    pathname: string;

                                                                      property search

                                                                      search: string;

                                                                        property state

                                                                        state: S;
                                                                          interface Link<TState>
                                                                          extends React.ForwardRefExoticComponent<
                                                                          React.PropsWithoutRef<LinkProps<TState>> &
                                                                          React.RefAttributes<HTMLAnchorElement>
                                                                          > {}

                                                                            interface LinkGetProps

                                                                            interface LinkGetProps {}

                                                                              property href

                                                                              href: string;

                                                                                property isCurrent

                                                                                isCurrent: boolean;

                                                                                  property isPartiallyCurrent

                                                                                  isPartiallyCurrent: boolean;

                                                                                    property location

                                                                                    location: WindowLocation;

                                                                                      interface LinkProps

                                                                                      interface LinkProps<TState> extends AnchorProps {}

                                                                                        property getProps

                                                                                        getProps?: ((props: LinkGetProps) => {}) | undefined;

                                                                                          property innerRef

                                                                                          innerRef?: React.Ref<HTMLAnchorElement> | undefined;
                                                                                          • Deprecated

                                                                                            If using React >= 16.4, use ref instead.

                                                                                          property replace

                                                                                          replace?: boolean | undefined;

                                                                                            property state

                                                                                            state?: TState | undefined;

                                                                                              property to

                                                                                              to: string;

                                                                                                interface LocationContext

                                                                                                interface LocationContext {}

                                                                                                  property location

                                                                                                  location: WindowLocation;

                                                                                                    property navigate

                                                                                                    navigate: NavigateFn;

                                                                                                      interface LocationProps

                                                                                                      interface LocationProps {}

                                                                                                        property children

                                                                                                        children: LocationProviderRenderFn;

                                                                                                          interface LocationProviderProps

                                                                                                          interface LocationProviderProps {}

                                                                                                            property children

                                                                                                            children?: React.ReactNode | LocationProviderRenderFn | undefined;

                                                                                                              property history

                                                                                                              history?: History | undefined;

                                                                                                                interface MatchProps

                                                                                                                interface MatchProps<TParams> {}

                                                                                                                  property children

                                                                                                                  children: MatchRenderFn<TParams>;

                                                                                                                    property path

                                                                                                                    path: string;

                                                                                                                      interface MatchRenderProps

                                                                                                                      interface MatchRenderProps<TParams> {}

                                                                                                                        property location

                                                                                                                        location: WindowLocation;

                                                                                                                          property match

                                                                                                                          match: null | ({ uri: string; path: string } & TParams);

                                                                                                                            property navigate

                                                                                                                            navigate: NavigateFn;
                                                                                                                              interface NavigateFn {}
                                                                                                                                (to: string, options?: NavigateOptions<{}>): Promise<void>;
                                                                                                                                  (to: number, options?: undefined): Promise<void>;
                                                                                                                                    interface NavigateOptions<TState> {}
                                                                                                                                      replace?: boolean | undefined;
                                                                                                                                        state?: TState | undefined;

                                                                                                                                          interface RedirectProps

                                                                                                                                          interface RedirectProps<TState> {}

                                                                                                                                            property from

                                                                                                                                            from?: string | undefined;

                                                                                                                                              property noThrow

                                                                                                                                              noThrow?: boolean | undefined;

                                                                                                                                                property replace

                                                                                                                                                replace?: boolean | undefined;

                                                                                                                                                  property state

                                                                                                                                                  state?: TState | undefined;

                                                                                                                                                    property to

                                                                                                                                                    to: string;

                                                                                                                                                      interface RedirectRequest

                                                                                                                                                      interface RedirectRequest {}

                                                                                                                                                        property uri

                                                                                                                                                        uri: string;

                                                                                                                                                          interface RouterProps

                                                                                                                                                          interface RouterProps {}

                                                                                                                                                            property basepath

                                                                                                                                                            basepath?: string | undefined;

                                                                                                                                                              property component

                                                                                                                                                              component?: React.ComponentType | string | undefined;

                                                                                                                                                                property location

                                                                                                                                                                location?: WindowLocation | undefined;

                                                                                                                                                                  property primary

                                                                                                                                                                  primary?: boolean | undefined;

                                                                                                                                                                    interface ServerLocationProps

                                                                                                                                                                    interface ServerLocationProps {}

                                                                                                                                                                      property url

                                                                                                                                                                      url: string;

                                                                                                                                                                        Type Aliases

                                                                                                                                                                        type AnchorProps

                                                                                                                                                                        type AnchorProps = Omit<
                                                                                                                                                                        React.DetailedHTMLProps<
                                                                                                                                                                        React.AnchorHTMLAttributes<HTMLAnchorElement>,
                                                                                                                                                                        HTMLAnchorElement
                                                                                                                                                                        >,
                                                                                                                                                                        'href' // remove href, as it's ignored by the router
                                                                                                                                                                        >;

                                                                                                                                                                          type HistoryActionType

                                                                                                                                                                          type HistoryActionType = 'PUSH' | 'POP';

                                                                                                                                                                            type HistoryListener

                                                                                                                                                                            type HistoryListener = (parameter: HistoryListenerParameter) => void;

                                                                                                                                                                              type HistoryLocation

                                                                                                                                                                              type HistoryLocation = WindowLocation & { state?: any };

                                                                                                                                                                                type HistoryUnsubscribe

                                                                                                                                                                                type HistoryUnsubscribe = () => void;

                                                                                                                                                                                  type LocationProviderRenderFn

                                                                                                                                                                                  type LocationProviderRenderFn = (context: LocationContext) => React.ReactNode;

                                                                                                                                                                                    type MatchRenderFn

                                                                                                                                                                                    type MatchRenderFn<TParams> = (props: MatchRenderProps<TParams>) => React.ReactNode;

                                                                                                                                                                                      type Omit

                                                                                                                                                                                      type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;

                                                                                                                                                                                        type RouteComponentProps

                                                                                                                                                                                        type RouteComponentProps<TParams = {}> = Partial<TParams> & {
                                                                                                                                                                                        path?: string | undefined;
                                                                                                                                                                                        default?: boolean | undefined;
                                                                                                                                                                                        location?: WindowLocation | undefined;
                                                                                                                                                                                        navigate?: NavigateFn | undefined;
                                                                                                                                                                                        uri?: string | undefined;
                                                                                                                                                                                        };

                                                                                                                                                                                          type WindowLocation

                                                                                                                                                                                          type WindowLocation<S = unknown> = Window['location'] & HLocation<S>;

                                                                                                                                                                                            Package Files (1)

                                                                                                                                                                                            Dependencies (1)

                                                                                                                                                                                            Dev Dependencies (0)

                                                                                                                                                                                            No dev dependencies.

                                                                                                                                                                                            Peer Dependencies (0)

                                                                                                                                                                                            No peer dependencies.

                                                                                                                                                                                            Badge

                                                                                                                                                                                            To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                            You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/reach__router.

                                                                                                                                                                                            • Markdown
                                                                                                                                                                                              [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/reach__router)
                                                                                                                                                                                            • HTML
                                                                                                                                                                                              <a href="https://www.jsdocs.io/package/@types/reach__router"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>