@cap3/capitano-components
Version:
# <div style="color: crimson;">ALPHA DISCLAIMER</div>
42 lines • 1.26 kB
TypeScript
import * as React from "react";
declare type SetState<S> = React.Component<{}, S>["setState"];
declare type ComponentRenderFunction<S> = (args: Args<S>) => React.ReactNode;
interface Args<S> {
state: S;
setState: SetState<S>;
forceUpdate: (callBack?: () => void) => void;
}
declare type ChildrenOrRender<S> = {
render?: undefined;
children: ComponentRenderFunction<S> | React.ReactNode;
} | {
render: ComponentRenderFunction<S>;
children?: undefined;
};
declare type Props<S> = ChildrenOrRender<S> & {
initialState?: S;
didMount?: (args: Args<S>) => void;
shouldUpdate?: (args: {
state: S;
nextState: S;
}) => boolean;
willUnmount?: (args: {
state: S;
}) => void;
didUpdate?: (args: Args<S> & {
prevState: S;
}) => void;
};
export declare class Component<S extends {}> extends React.Component<Props<S>, S> {
state: S;
private _setState;
private _forceUpdate;
getArgs(): Args<S>;
componentDidMount(): void;
shouldComponentUpdate(_: Props<S>, nextState: S): boolean;
componentWillUnmount(): void;
componentDidUpdate(_: Props<S>, prevState: S): void;
render(): {} | null | undefined;
}
export {};
//# sourceMappingURL=Component.d.ts.map