我正在学习 redux 并想出了一个使用返回数据的 web 服务的示例。一切正常。但是我在下面配置了 redux 开发者工具。
我收到一条错误消息,说我的商店被分配了一个值但从未使用过,当我进入我的开发工具时,我看不到我的状态数据。难道我做错了什么?
import React from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter as Router, Route } from 'react-router-dom';
import promise from 'redux-promise';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware, compose } from 'redux';
import reducers from './reducers';
import ProductsIndex from './components/products_index';
const createStoreWithMiddleware = applyMiddleware(promise)(createStore);
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const store = createStore(
reducers,
composeEnhancers(applyMiddleware())
);
ReactDOM.render(
<Provider store={createStoreWithMiddleware(reducers)}>
<Router>
<div>
<Route path="/" component={ProductsIndex} />
</div>
</Router>
</Provider>
, document.querySelector('#root'));
错误:第 14:7 行:“商店”被分配了一个值,但从未使用过 no-unused-vars