bigbuffet-rw/packages/pl-fe/src/hooks/use-compose.ts
marcin mikołajczak 2963504736 pl-fe: Rename files to kebab case
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2024-10-26 00:06:13 +02:00

9 lines
414 B
TypeScript

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