Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redux-devtools-extension插件配置 #13

Open
253867843 opened this issue Aug 3, 2019 · 0 comments
Open

redux-devtools-extension插件配置 #13

253867843 opened this issue Aug 3, 2019 · 0 comments
Assignees
Labels
react react学习

Comments

@253867843
Copy link
Owner

253867843 commented Aug 3, 2019

调试工具

方式1:

import {createStore, applyMiddleware, compose} from 'redux';
import reducer from './reducer';
import thunk from 'redux-thunk';

const composeEnhancers = 
     window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

const enhancer = composeEnhancers(
  applyMiddleware(thunk), // 表示在创建store时, 会使用redux-thunk中间件
);

const store = createStore(reducer, enhancer);

export default store;

方式2:

const store = createStore(counter, compose(
  applyMiddleware(thunk),
  window.devToolsExtension ? window.devToolsExtension() : f => f
));
@253867843 253867843 added the react react学习 label Aug 3, 2019
@253867843 253867843 self-assigned this Aug 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
react react学习
Projects
None yet
Development

No branches or pull requests

1 participant