小编aca*_*222的帖子

无法读取未定义的属性'then'

所以我正在使用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)

javascript redux redux-thunk react-redux

2
推荐指数
1
解决办法
2879
查看次数

标签 统计

javascript ×1

react-redux ×1

redux ×1

redux-thunk ×1