import { createStore, applyMiddleware,compose } from "redux";
import thunk from "redux-thunk";
import rootReducer from "./reducers/index";

const initialState = {};
const middleware = [thunk]
const store = createStore(
    rootReducer, 
    initialState,
    compose(
        applyMiddleware(...middleware),
        window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
    )
    
    ) //数组,对象,方法


export default store
  1. 下载插件
  2. 引入compose
  3. 将所需要文件放置到compose

@20181122 补充

在React+TypeScript项目实践中发现redux Dev tool 对ts项目支持性能并不是很好

具体解决方案

hello all, just in case this is useful to others, i personally found this middleware-less code readable enough:

const store = createStore(
  rootReducer,
  initialState,
  (window as any).__REDUX_DEVTOOLS_EXTENSION__ &&
    (window as any).__REDUX_DEVTOOLS_EXTENSION__()
);

note that you many need to set no-any to false in your tslint.json file

会对某些东西不支持,具体请访问

https://github.com/zalmoxisus/redux-devtools-extension/issues/134#issuecomment-379861240