@livelike/react-native
Version:
LiveLike React Native package
17 lines (14 loc) • 441 B
text/typescript
import { widgetStore } from '../store';
import { useSelectedFieldStore } from './useSelectedFieldStore';
export type UseWidgetSelectedOptionIndexArg = {
widgetId: string;
};
export function useWidgetSelectedOptionIndex({
widgetId,
}: UseWidgetSelectedOptionIndexArg) {
const selectedOptionIndex = useSelectedFieldStore(
widgetStore,
() => widgetStore.get()[widgetId]?.selectedOptionIndex
);
return selectedOptionIndex;
}