gpt4 book ai didi

react-native - 更新 react-native 后无法使用 react-native-debugger

转载 作者:行者123 更新时间:2023-12-03 22:53:30 24 4
gpt4 key购买 nike

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 开发工具的同时,您需要将开发工具用作 Composer 本身:

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我认为这是你的,但我想我会在这里再次发布答案,以防有人在这里看到它。

希望这可以帮助!

关于react-native - 更新 react-native 后无法使用 react-native-debugger,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52946133/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com