stream-chat-react-native-core
Version:
The official React Native and Expo components for Stream Chat, a service for building chat applications
14 lines (11 loc) • 387 B
text/typescript
import { PollState } from 'stream-chat';
import { usePollContext } from '../../../contexts';
import { useStateStore } from '../../../hooks';
export const usePollStateStore = <
T extends Readonly<Record<string, unknown> | Readonly<unknown[]>>,
>(
selector: (nextValue: PollState) => T,
): T => {
const { poll } = usePollContext();
return useStateStore(poll.state, selector);
};