【问题标题】:Applying tracing options to a redux-thunk setup将跟踪选项应用于 redux-thunk 设置
【发布时间】:2021-06-27 00:53:48
【问题描述】:

我最近将我的 react 本机应用程序设置为使用 redux-devtools-extension,现在我正在尝试弄清楚如何应用堆栈跟踪。目前我的商店是这样写的:

import reduxThunk from 'redux-thunk';

const persistedReducer = persistReducer(persistConfig, reducers);

const store = createStore(
  persistedReducer,
  composeWithDevTools(applyMiddleware(reduxThunk)),
);

我基本上想应用以下选项,以便可以查看从何处调用操作:

{
  trace: true, 
  traceLimit: 25,
}

鉴于上述情况,我该如何改造我目前的设置?

【问题讨论】:

    标签: reactjs react-native redux-thunk react-devtools


    【解决方案1】:

    documentation 在这里解释。我认为文件应该是这样的。

    import reduxThunk from 'redux-thunk';
    
    const persistedReducer = persistReducer(persistConfig, reducers);
    const composeEnhancers = composeWithDevTools({ trace: true, traceLimit: 25});
    
    const store = createStore(
      persistedReducer,
      composeEnhancers(applyMiddleware(reduxThunk)),
    );
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-06-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-18
      • 2017-10-08
      • 2018-09-10
      相关资源
      最近更新 更多