我在这里遵循了指南:https ://redux-observable.js.org/docs/basics/SettingUpTheMiddleware.html(部分:Redux DevTools)
商店的配置方式如下:
// @flow
import { createStore, compose, applyMiddleware } from 'redux';
import { createEpicMiddleware } from 'redux-observable';
import { createReducer } from './reducer';
import { epic } from './epic';
const initialState = {};
const configureStore = () => {
const epicMiddleware = createEpicMiddleware(epic);
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const enhancers = composeEnhancers(applyMiddleware(epicMiddleware));
const store = createStore(createReducer(), initialState, enhancers);
return store;
};
export { configureStore };
但是,如果我没有安装 Redux Devtools Extension,我的 React 应用程序(使用 CRA 引导)将无法工作。
有人可以告诉我我做错了什么吗?
缺少扩展的错误日志:https ://pastebin.com/qzcbXCYQ
编辑:我是个白痴。商店在两个文件中定义,我没有更改从中导入它的那个。清理了重复项,它按预期工作。