如何在redux toolkit中添加redux devtools ?
import { configureStore, getDefaultMiddleware, compose } from '@reduxjs/toolkit';
import reducers from './reducers';
import createSagaMiddleware from 'redux-saga';
import saga from './saga';
const sagaMiddleware = createSagaMiddleware();
const store = configureStore({
reducer: reducers,
devTools: process.env.NODE_ENV !== 'production',
middleware: getDefaultMiddleware => getDefaultMiddleware({ thunk: false }).concat(sagaMiddleware)
});
sagaMiddleware.run(saga);
export default store;
..................................................
默认情况下使用configureStore()激活,您可以使用此工具访问它。react-native-debugger
官方文档使用configureStore简化存储设置section: https://redux-toolkit.js.org/usage/usage-guide#simplifying-store-setup-with-configurestore,您不需要添加任何其他内容,因为它已经为您完成了。