Repository URL to install this package:
|
Version:
7.0.0 ▾
|
/**
* @todo @@perf @deprecated need to update to not use old context
* @type @see https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-router/index.d.ts
* @see https://github.com/ReactTraining/react-router/blob/master/packages/react-router/modules/RouterContext.js
*/
import * as React from 'react';
import { OneRouterToRuleThemAll as OneRouter } from './OneRouterToRuleThemAll';
import { oneRouter } from './oneRouter';
import { ReactRouterContextValue } from './typings';
import { OneRouterContext } from './Context';
/**
* @name OneRouterProvider < adding as alias instead of `container`
*
* @todo @@perf PureComponents
*
* @todo we also want to provide context
* (since `react-router` does not export theirs publicly yet)
* this will require changing it from
* @example
* <>
* <OneRouterContainer />
* <App />
* </>
*
* =>
* <>
* <OneRouterContainer>
* <App />
* <OneRouterContainer />
* </>
*/
declare class OneRouterWrap extends React.Component {
/**
* @note this is the same as <RouterContext.Consume>
*/
static contextType: React.Context<ReactRouterContextValue<OneRouter<any>>>;
context: ReactRouterContextValue<OneRouter>;
componentWillMount(): void;
render(): JSX.Element;
}
/**
* @alias OneRouterContainer
* @note this is the top top top top level of our app
* @note this was done this way when we were extracting props from old context (to scope props)
*/
declare const provideOneRouter: (_props: any) => React.ComponentElement<{}, OneRouterWrap>;
declare const withOneRouter: (Target: React.ComponentType<{}>) => {
new (props: Readonly<{}>): {
render(): JSX.Element;
context: any;
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<{}>) => {} | Pick<{}, K>) | Pick<{}, K>, callback?: () => void): void;
forceUpdate(callBack?: () => void): void;
readonly props: Readonly<{
children?: React.ReactNode;
}> & Readonly<{}>;
state: Readonly<{}>;
refs: {
[key: string]: React.ReactInstance;
};
componentDidMount?(): void;
shouldComponentUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): boolean;
componentWillUnmount?(): void;
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
getSnapshotBeforeUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>): any;
componentDidUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>, snapshot?: any): void;
componentWillMount?(): void;
UNSAFE_componentWillMount?(): void;
componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
UNSAFE_componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
};
new (props: {}, context?: any): {
render(): JSX.Element;
context: any;
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<{}>) => {} | Pick<{}, K>) | Pick<{}, K>, callback?: () => void): void;
forceUpdate(callBack?: () => void): void;
readonly props: Readonly<{
children?: React.ReactNode;
}> & Readonly<{}>;
state: Readonly<{}>;
refs: {
[key: string]: React.ReactInstance;
};
componentDidMount?(): void;
shouldComponentUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): boolean;
componentWillUnmount?(): void;
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
getSnapshotBeforeUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>): any;
componentDidUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>, snapshot?: any): void;
componentWillMount?(): void;
UNSAFE_componentWillMount?(): void;
componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
UNSAFE_componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
};
contextType?: React.Context<any>;
};
export { OneRouterContext, provideOneRouter as OneRouterContainer, OneRouterWrap as OneRouterProvider, provideOneRouter, withOneRouter, oneRouter, OneRouterWrap, };