use-sharable-state
Version:
This packages makes sharing states simpler
33 lines (32 loc) • 916 B
TypeScript
declare const store: {
mappedData: {
[K: string]: {
value: any;
setters: {
[K: string]: (state: any) => void;
};
};
};
addSetter: ({ stateKey, setterKey, setter, initialValue, }: {
stateKey: string;
setterKey: string;
setter: (state: any) => void;
initialValue?: any;
}) => void;
removeSetter: ({ stateKey, setterKey, }: {
stateKey: string;
setterKey: string;
}) => void;
updateState: ({ stateKey, value, }: {
stateKey: string;
value: any;
}) => void;
getCurrentState: (stateKey: string) => any;
getCurrentSetter: ({ stateKey, setterKey, }: {
stateKey: string;
setterKey: string;
}) => (state: any) => void;
generateId: () => string;
clearStates: () => void;
};
export default store;