小编jMc*_*McG的帖子

未捕获的错误:操作必须是普通对象

我已经用这个标题倾注了所有问题,但我找不到可以防止此错误的解决方案.我到目前为止所尝试的是确保我不会混淆新旧redux api,我正在使用babel进行转换,所以没有打字原则解决方案适用,我已经确保我在相关动作中返回一个函数,我已经注释掉我的导入或thunk以确保它中断并且我在导入它之后注销了thunk并且我得到了一个函数,并且我已经从depricated版本更新了devtools扩展.没有成功.任何帮助深表感谢.相关代码如下:

商店:

const redux = require('redux');
const {combineReducers, createStore, compose, applyMiddleware} = require('redux');
import {default as thunk} from 'redux-thunk';

const {nameReducer, hobbyReducer, movieReducer, mapReducer} = require('./../reducers/index');

export const configure = () => {

    const reducer = combineReducers({
        name: nameReducer,
        hobbies: hobbyReducer,
        movies: movieReducer,
        map: mapReducer
    });

    const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

    const store = createStore(reducer, composeEnhancers(applyMiddleware(thunk)));   

    return store;
};
Run Code Online (Sandbox Code Playgroud)

操作:

export let startLocationFetch = () => {type: 'START_LOCATION_FETCH'};

export let completeLocationFetch = (url) => {type: 'COMPLETE_LOCATION_FETCH', url};

export …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs redux redux-thunk axios

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

标签 统计

axios ×1

javascript ×1

reactjs ×1

redux ×1

redux-thunk ×1