猿问

redux-devtools-extension 使用报错

//创建store的代码 程序正常使用

import { createStore} from 'redux';

import reducer from './reducer';

const store = createStore(reducer);

export default store;

//改变之后报错

import { createStore ,compose } from 'redux';

import reducer from './reducer';

const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

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

export default store;


请教可能造成的原因 拓展程序的版本是2.15.1


慕容3067478
浏览 1774回答 3
3回答

HUH函数

你这种连接redux-devtools-extension的方式不怎么清楚,我通常是这样连接的import { createStore } from 'redux'import { composeWithDevTools } from 'redux-devtools-extension'import reducer from './reducer'export default createStore(reducer, composeWithDevTools())

月关宝盒

const reduxDevTools = window.devToolsExtension    ? window.devToolsExtension()    : () => {    } const store = createStore(reducer, compose(    reduxDevTools,))或 const store = createStore(reducer,        window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOOLS_EXTENSION__() : undefined    );官方文档
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答