bigbuffet-rw/app/soapbox/hooks/useCompose.ts

9 lines
406 B
TypeScript
Raw Normal View History

import { useAppSelector } from 'soapbox/hooks';
import type { ReducerCompose } from 'soapbox/reducers/compose';
/** Get compose for given key with fallback to 'default' */
export const useCompose = <ID extends string>(composeId: ID extends 'default' ? never : ID): ReturnType<typeof ReducerCompose> => {
return useAppSelector((state) => state.compose.get(composeId, state.compose.get('default')!));
};