UNPKG

react-history-switch

Version:

Self-hosted context-free Switch routing component for History.js library (React). The library was created to transfer navigation responsibility from a view into Mobx state container (MVC). Also can be used separately as a self-hosted router

60 lines (54 loc) 2.34 kB
// Generated by dts-bundle v0.7.3 // Dependencies for this module: // ../react // ../history declare module 'react-history-switch' { import ISwitchItemInternal from 'react-history-switch/model/ISwitchItem'; import Link from 'react-history-switch/lib/Link'; import Switch from 'react-history-switch/lib/Switch'; export { Switch, Link }; export type ISwitchItem = ISwitchItemInternal; } declare module 'react-history-switch/model/ISwitchItem' { export interface ISwitchItem { path: string; element?: React.ComponentType<any>; guard?: () => boolean | Promise<boolean>; prefetch?: (params: Record<string, any>) => Record<string, any> | Promise<Record<string, any>>; unload?: (params: Record<string, any>) => Promise<void> | void; redirect?: string | ((params: Record<string, any>) => string | null); } export default ISwitchItem; } declare module 'react-history-switch/lib/Link' { import * as React from 'react'; interface ILinkProps extends Omit<React.HTMLProps<HTMLAnchorElement>, 'href'> { to: string; } export const Link: ({ to, ...otherProps }: ILinkProps) => JSX.Element; export default Link; } declare module 'react-history-switch/lib/Switch' { import { BrowserHistory, HashHistory, MemoryHistory } from 'history'; import React from 'react'; export interface ISwitchItem { path: string; element?: React.ComponentType<any>; guard?: () => boolean | Promise<boolean>; prefetch?: (params: Record<string, any>) => Record<string, any> | Promise<Record<string, any>>; unload?: (params: Record<string, any>) => Promise<void> | void; redirect?: string | ((params: Record<string, any>) => string | null); } export interface ISwitchProps { items: ISwitchItem[]; history?: BrowserHistory | MemoryHistory | HashHistory; Forbidden?: React.ComponentType<any>; NotFound?: React.ComponentType<any>; Loader?: React.ComponentType<any>; Error?: React.ComponentType<any>; onLoadStart?: () => void; onLoadEnd?: (isOk?: boolean) => void; } export const Switch: ({ Loader, Forbidden, NotFound, Error, history, items, onLoadStart, onLoadEnd, }: ISwitchProps) => JSX.Element; export default Switch; }