reactjs - 无法在 ubuntu 上的 reactotron 中订阅 react-redux 状态
问题描述
我想将 reactotron 添加到我的 react-redux 应用程序中 - 我正在使用 rematch redux 插件。Redux 工作正常,我也可以连接到 reactotron 桌面应用程序,但我无法订阅任何状态。当我想订阅它时,什么也没有发生。
只有副标题:'没有订阅。你可以通过按 ctrl + n 订阅你的 redux 存储中的状态。
在 reactotron 应用程序的时间线上,我可以看到我与这些细节的联系:
environment undefined
reactotronLibraryName reactotron-react-js
reactotronLibraryVersion 2.1.1
platform browser
platformVersion Linux x86_64
userAgent Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0
screenWidth 1920
screenHeight 1080
screenScale 1
windowWidth 1853
windowHeight 951
name FoodGlobal
clientId 6f463c04-0d7a-8786-112b-53a630036930
reactotronCoreClientVersion 2.8.2
address ::ffff:192.168.0.59
这是我的反应器配置:
import Reactotron from 'reactotron-react-js';
import {reactotronRedux} from 'reactotron-redux';
const reactotron = Reactotron.configure({
name: 'FoodGlobal',
host: '127.0.0.1'
})
.use(reactotronRedux());
reactotron.connect();
export default reactotron;
这里是 redux 存储配置:
import thunk from "redux-thunk";
import selectPlugin from "@rematch/select";
import { init } from "@rematch/core";
import * as models from "./models";
import reactotron from './reactotron';
export const store = init({
models,
redux: {
createStore: reactotron.createStore,
middlewares: [thunk]
},
plugins: [selectPlugin()]
});
export const { dispatch } = store;
export default store;
谢谢你的帮助。
解决方案
您可以在不输入任何内容的情况下按 enter ,它将订阅 state 。如果这不起作用,请按照以下步骤操作。
ReactotronConfig.js
import { AsyncStorage } from 'react-native';
import Reactotron from 'reactotron-react-native';
import { reactotronRedux } from 'reactotron-redux';
import sagaPlugin from 'reactotron-redux-saga';
const reactotron = Reactotron.setAsyncStorageHandler(AsyncStorage)
.configure() // controls connection & communication settings
.use(reactotronRedux())
.use(sagaPlugin())
.useReactNative() // add all built-in react native plugins
.connect(); // let's connect!
creaeStore.ts
import Reactotron from '../../ReactotronConfig';
const sagaMonitor = Reactotron.createSagaMonitor();
const sagaMiddleware = createSagaMiddleware({ sagaMonitor });
const store = createStore(rootReducer, compose(...enhancers, Reactotron.createEnhancer()));
以上代码来自我的文件,但您的配置似乎略有不同。请按照以下两个步骤
推荐阅读
- azure-active-directory - 使用 AAD 令牌保护 .Net Core 3 Web API
- .net - 如何在 Windows 桌面应用程序中隐藏 API 发布 URL?
- python - 如何修复:Pytest“创建测试”对话框不会在 Pycharm 中打开
- c# - 使用 ASP.NET Core 3,如何使 json 响应不序列化复杂类型?
- .htaccess - 需要重定向 301 .htaccess
- google-app-engine - 如何在 GAE 中手动管理 Memorystore Redis 中的密钥?
- python-3.x - 在kivy中调整高度和宽度textInput
- python - 从用户输入中正确使用类和字典
- android - 在 null 上调用了方法“map”
- algorithm - 从每个节点中找到最高可达节点