类型错误:您提供了预期流的无效对象.冗余观察问题



伙计们。 我在可观察的 redux 中遇到问题。提前感谢您的回答。 在此处输入图像描述

//action.js
import { map,mergeMap } from 'rxjs/operators';
import {ofType } from 'redux-observable'
import { ajax } from 'rxjs/ajax';

const fetchUser = username => ({ type: 'FETCH_USER', payload: username });
export const fetchUserFulfilled = payload => ({ type: 'FETCH_USER_FULFILLED', payload });
export const fetchUserEpic = action$ => action$.pipe(
ofType('FETCH_USER'),
mergeMap(action =>
ajax.getJSON(`https://api.github.com/users/${action.payload}`).pipe(
map(response => fetchUserFulfilled(response))
)
)
);
export default fetchUser

商店

const epicMiddleware = createEpicMiddleware();
const store = createStore(rootReducer,applyMiddleware(epicMiddleware))
epicMiddleware.run(rootEpic);

我找到了答案。这不是可观察的冗余问题。

我导入了史诗而不是动作创作者,并在反应组件中使用它。

谢谢。

最新更新