2024-10-25 15:06:13 -07:00
|
|
|
import { useAppSelector } from './use-app-selector';
|
2022-09-14 11:01:00 -07:00
|
|
|
|
2024-08-28 04:41:08 -07:00
|
|
|
import type { ReducerCompose } from 'pl-fe/reducers/compose';
|
2022-09-14 11:01:00 -07:00
|
|
|
|
|
|
|
/** Get compose for given key with fallback to 'default' */
|
2024-05-13 10:00:42 -07:00
|
|
|
const useCompose = <ID extends string>(composeId: ID extends 'default' ? never : ID): ReturnType<typeof ReducerCompose> =>
|
2024-05-12 16:18:04 -07:00
|
|
|
useAppSelector((state) => state.compose.get(composeId, state.compose.get('default')!));
|
2024-05-13 10:00:42 -07:00
|
|
|
|
|
|
|
export { useCompose };
|