metaf-react
Version:
Resolvable component and injection root for adding DI/IoC to React App
49 lines • 1.99 kB
TypeScript
import { IOverrideResult } from 'metaf-resolvable';
import { Component } from 'react';
import { HOC, IRequirementsOverride } from './Resolver';
/**
* @description ApplicationRoot props
*/
export interface IApplicationRootProps {
/**
* Entities of this array meant to be built with `dependency` helper
* @description array of overrides for `dependencies`
*/
dependencies: IOverrideResult[];
/**
* Entities of this array meant to be built with `requirement` helper
* @description array of overrides for `requirements`
*/
requirements: IRequirementsOverride[];
}
interface IApplicationRootState {
hocs: HOC[];
}
/**
* Component that is used for declaring overrides for `dependencies` and `requirements`.
* Also `requirements` HOCs applied to `render` method of this component in order to
* wrap you application tree for providing proper environment for your `ResolvableComponent`s
* @description ApplicationRoot Component
* > **NOTE:** `<ApplicationRoot>` is meant to appear only once in your app
* and in majority of cases it should be the first and only wrapper around
* your `App` component. Adding other `ApplicationRoot`s somewhere in your app
* won't affect dependency resolution mechanism but instead will throw an error
*/
export declare class ApplicationRoot extends Component<IApplicationRootProps, IApplicationRootState> {
/**
* by default there are no predefined `dependencies` or `requirements`
* @description default props of `ApplicationRoot` component
*/
static defaultProps: {
dependencies: never[];
requirements: never[];
};
/**
* Creates an instance of application root.
* @param props contains overrides for `dependencies` and `requirements`
*/
constructor(props: Readonly<IApplicationRootProps>);
render(): import("react").ReactNode;
}
export {};
//# sourceMappingURL=ApplicationRoot.d.ts.map