index.ts 663 B

1234567891011121314151617181920212223
  1. import { configureStore } from '@reduxjs/toolkit'
  2. import {
  3. TypedUseSelectorHook,
  4. useDispatch as useDispatchRaw,
  5. useSelector as useSelectorRaw
  6. } from 'react-redux'
  7. import { hotsReducer } from './hots'
  8. import { sceneReducer } from './scene'
  9. const store = configureStore({
  10. reducer: {
  11. hots: hotsReducer,
  12. scenes: sceneReducer
  13. }
  14. })
  15. export type StoreState = ReturnType<typeof store.getState>
  16. export type AppDispatch = typeof store.dispatch
  17. export type AppSelector = TypedUseSelectorHook<StoreState>
  18. export const useDispatch: () => AppDispatch = useDispatchRaw as any
  19. export const useSelector: AppSelector = useSelectorRaw as any
  20. export default store