Reactjs epicMiddleware.run(rootEpic)from';可观察的重复次数';
无法解决此问题,系统希望从“redux observable”导入{epicMiddleware.run(rootEpic)}行中的“,”而不是“.”代码> 然而,我是根据官方文件写的 这是我的代码:Reactjs epicMiddleware.run(rootEpic)from';可观察的重复次数';,reactjs,redux,rxjs,Reactjs,Redux,Rxjs,无法解决此问题,系统希望从“redux observable”导入{epicMiddleware.run(rootEpic)}行中的“,”而不是“.” 然而,我是根据官方文件写的 这是我的代码: import React from 'react' import ReactDOM from 'react-dom' import './index.css' import App from './App' import { createStore, applyMiddleware } from 'r
import React from 'react'
import ReactDOM from 'react-dom'
import './index.css'
import App from './App'
import { createStore, applyMiddleware } from 'redux';
import { epicMiddleware.run(rootEpic) } from 'redux-observable';
import { Provider } from 'react-redux';
import rootReducer from './reducers/root';
import { rootEpic } from './epics';
const epicMiddleware = epicMiddleware.run(rootEpic);
const store = createStore(rootReducer, applyMiddleware(epicMiddleware));
const appWithProvider = (
<Provider store={store}>
<App />
</Provider>
);
ReactDOM.render(appWithProvider, document.getElementById('root'))
您的导入声明是错误的,您应该按照下面的方式导入
import { createEpicMiddleware } from 'redux-observable';
import { rootEpic } from './epics';
像这样使用它
const epicMiddleware = createEpicMiddleware();
epicMiddleware.run(rootEpic);
const epicMiddleware = createEpicMiddleware();
epicMiddleware.run(rootEpic);