mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-12 17:45:22 +00:00
40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
// SPDX-License-Identifier: MIT
|
|
// Copyright (c) 2020-2021 The Pybricks Authors
|
|
|
|
import { TypedUseSelectorHook, useSelector as useReduxSelector } from 'react-redux';
|
|
import { Reducer, combineReducers } from 'redux';
|
|
import app from './app/reducers';
|
|
import ble from './ble/reducers';
|
|
import editor from './editor/reducers';
|
|
import firmware from './firmware/reducers';
|
|
import hub from './hub/reducers';
|
|
import licenses from './licenses/reducers';
|
|
import bootloader from './lwp3-bootloader/reducers';
|
|
import settings from './settings/reducers';
|
|
|
|
/**
|
|
* Root reducer for redux store.
|
|
*/
|
|
export const rootReducer = combineReducers({
|
|
app,
|
|
bootloader,
|
|
ble,
|
|
editor,
|
|
firmware,
|
|
hub,
|
|
licenses,
|
|
settings,
|
|
});
|
|
|
|
/**
|
|
* Root state for redux store.
|
|
*/
|
|
type StateFromReducer<R> = R extends Reducer<infer S> ? S : never;
|
|
|
|
export type RootState = StateFromReducer<typeof rootReducer>;
|
|
|
|
/**
|
|
* Typed version of react-redux useSelector() hook.
|
|
*/
|
|
export const useSelector: TypedUseSelectorHook<RootState> = useReduxSelector;
|