更新 react-native 后无法使用 react-native-debugger
Unable to use react-native-debugger after updating react-native
React Native Debugger 应用程序版本:v0.8.1
React Native 版本:0.57.3
我遇到了这个错误
It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function
在我从 0.55 更新之前它一直在工作。
这就是我创建商店的方式。
import { createStore, compose, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import reducers from '../reducers';
const store = createStore(
reducers,
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__(),
compose(applyMiddleware(thunk)),
);
export default store;
当我使用Chrome调试时,它工作正常。
请帮忙,谢谢
无需将三个参数传递给 createStore
函数,您需要传递两个参数(其中一个用于预加载状态,我们在此不使用)。为了解决这个问题,在仍然使用 redux 开发工具的同时,您需要将开发工具用作作曲家本身:
import { createStore, compose, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import reducers from '../reducers';
const composeEnhancer = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const store = createStore(
reducers,
composeEnhancer(applyMiddleware(thunk)),
);
export default store;
在深入了解 redux 库、调试器应用程序和开发工具的源代码后,我意识到这是解决方案,并找到了以下部分:https://github.com/zalmoxisus/redux-devtools-extension#12-advanced-store-setup
我也看到了一个几乎相同的问题 on github,我认为这是你的问题,但我想我会 post 在这里再次回答,以防有人在这里看到它。
希望对您有所帮助!
因为我遇到了同样的问题,想使用redux-devtools-extension,这里提供的解决方案无法应用1:1。这个人是如何完成这项工作的:
import { applyMiddleware, combineReducers, createStore } from 'redux';
import appConfigReducer from '../reducers/appConfigReducer';
import logger from 'redux-logger'
import { composeWithDevTools } from "redux-devtools-extension";
const rootReducer = combineReducers(
{config: appConfigReducer}
);
const composeEnhancers = composeWithDevTools({
// options like actionSanitizer, stateSanitizer
});
const configureStore = () => {
return createStore(rootReducer,
composeEnhancers(applyMiddleware(logger))
);
};
export default configureStore;
React Native Debugger 应用程序版本:v0.8.1
React Native 版本:0.57.3
我遇到了这个错误
It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function
在我从 0.55 更新之前它一直在工作。
这就是我创建商店的方式。
import { createStore, compose, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import reducers from '../reducers';
const store = createStore(
reducers,
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__(),
compose(applyMiddleware(thunk)),
);
export default store;
当我使用Chrome调试时,它工作正常。
请帮忙,谢谢
无需将三个参数传递给 createStore
函数,您需要传递两个参数(其中一个用于预加载状态,我们在此不使用)。为了解决这个问题,在仍然使用 redux 开发工具的同时,您需要将开发工具用作作曲家本身:
import { createStore, compose, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import reducers from '../reducers';
const composeEnhancer = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const store = createStore(
reducers,
composeEnhancer(applyMiddleware(thunk)),
);
export default store;
在深入了解 redux 库、调试器应用程序和开发工具的源代码后,我意识到这是解决方案,并找到了以下部分:https://github.com/zalmoxisus/redux-devtools-extension#12-advanced-store-setup
我也看到了一个几乎相同的问题 on github,我认为这是你的问题,但我想我会 post 在这里再次回答,以防有人在这里看到它。
希望对您有所帮助!
因为我遇到了同样的问题,想使用redux-devtools-extension,这里提供的解决方案无法应用1:1。这个人是如何完成这项工作的:
import { applyMiddleware, combineReducers, createStore } from 'redux';
import appConfigReducer from '../reducers/appConfigReducer';
import logger from 'redux-logger'
import { composeWithDevTools } from "redux-devtools-extension";
const rootReducer = combineReducers(
{config: appConfigReducer}
);
const composeEnhancers = composeWithDevTools({
// options like actionSanitizer, stateSanitizer
});
const configureStore = () => {
return createStore(rootReducer,
composeEnhancers(applyMiddleware(logger))
);
};
export default configureStore;