@livelike/react-native
Version:
LiveLike React Native package
31 lines (24 loc) • 652 B
text/typescript
import { createStore } from './store';
export type ITextAskState = {
inputText: string;
};
export type TextAskStoreValue = Record<string, ITextAskState>;
const initialTextAskStoreValue: TextAskStoreValue = {};
export const textAskWidgetStore = createStore(initialTextAskStoreValue);
export type IUpdateTextAskInputTextAction = {
widgetId: string;
inputText: string;
};
export const textAskWidgetStoreActions = {
updateTextAskInputTextAction({
widgetId,
inputText,
}: IUpdateTextAskInputTextAction) {
textAskWidgetStore.set({
...textAskWidgetStore.get(),
[widgetId]: {
inputText,
},
});
},
};