所以我正在使用react + redux,我继续得到以下错误:"无法读取属性'然后'未定义".由于某种原因,承诺不会被退回.我也特别擅长使用redux thunk.
减速器
import { merge } from 'lodash';
import * as APIutil from '../util/articles_api_util';
import {
ArticleConstants
} from '../actions/article_actions';
const ArticlesReducer = (state = {}, action) => {
switch (action.type) {
case ArticleConstants.RECEIVE_ALL_ARTICLES:
debugger
return merge({}, action.articles);
default:
return state;
}
};
export default ArticlesReducer;
Run Code Online (Sandbox Code Playgroud)
商店
import { createStore, applyMiddleware } from 'redux';
import RootReducer from '../reducers/root_reducer';
import thunk from 'redux-thunk';
import * as APIUtil from '../util/articles_api_util';
export const ArticleConstants = {
RECEIVE_ALL_ARTICLES: "RECEIVE_ALL_ARTICLES",
REQUEST_ALL_ARTICLES: "REQUEST_ALL_ARTICLES" …Run Code Online (Sandbox Code Playgroud)