undux
Version:
Dead simple state management for React
27 lines (26 loc) • 898 B
TypeScript
import * as React from 'react';
import { EffectsAs, Store } from '..';
import { Diff } from '../utils';
export type ContainerPropsAs<States extends {
[alias: string]: any;
}> = {
children: React.ReactNode;
effects?: EffectsAs<States>;
initialStates?: States;
};
export type CreateConnectedStoreAs<States extends {
[alias: string]: any;
}> = {
Container: React.ComponentType<ContainerPropsAs<States>>;
useStores(): {
[K in keyof States]: Store<States[K]>;
};
withStores: <Props extends {
[K in keyof States]: Store<States[K]>;
}>(Component: React.ComponentType<Props>) => React.ComponentType<Diff<Props, {
[K in keyof States]: Store<States[K]>;
}>>;
};
export declare function createConnectedStoreAs<States extends {
[alias: string]: any;
}>(initialStates: States, effects?: EffectsAs<States>): CreateConnectedStoreAs<States>;