React Redux Toolkit:将存储导入到单独的文件时,没有为键 "myReducer" 提供缩减程序

React Redux Toolkit: No reducer provided for key "myReducer" when importing store to separate files

我正在尝试对 React 组件外部的某个事件发送 redux 操作。但是当我在包含此事件处理程序的单独的 js 文件中执行 import store from '../../app/store' 时,我在组件中收到以下错误:

No reducer provided for key "myReducer"

我的文件:

store.js:

import { configureStore } from '@reduxjs/toolkit';
// ...
import rootReducer from './rootReducer'

const middleware = //...

const store = configureStore({
  reducer: rootReducer,
  middleware
});

export default store;

rootReducer:

import { combineReducers } from 'redux';

// reducers created with createSlice and exported like this: export default SomeFeatureSlice.reducer;
import myReducer from '../features/my/mySlice' 
import SomeFeatureReducer from '../features/some_feature/SomeFeatureSlice'


const rootReducer = combineReducers({
    //...
    myReducer,
    SomeFeatureReducer
});

export default rootReducer;

组件:

// ...
const mapStateToProps = state => ({
    some_prop: state.myReducer.some_prop
})
// ...

处理程序:

// ...
import store from '../../app/store'
// an action exported this way: export const { myAction } = SomeFeatureSlice.actions;
import { myAction } from '../../features/some_feature/SomeFeatureSlice'
//...
store.dispatch(myAction());
//...

index.js:

import store from './app/store';
// ...

ReactDOM.render(
  <React.Fragment> 
    <Provider store={store}>
      <App />
    </Provider>
  </React.Fragment>,
  document.getElementById('root')
);

当我从处理程序中删除 import store 语句时,一切正常。我做错了什么?

我不确定“handler.js”文件在您的应用程序中的位置。

但是: