Cannot subscribe react-redux state in reactotron on ubuntu

1.4k Views Asked by At

I want to add reactotron to my react-redux app - I'm using rematch redux plugin. Redux works correct and I can also connect to reactotron desktop app, but I can not subscribe any state. When I want to subscribe it nothing happen.

There is only subtitle: 'No subscriptions. You can subscribe to state in your redux store by pressing ctrl + n.'

On timeline of reactotron app I can see my connection with such details:

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

Here is my reactotron config:

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;

And here redux store config:

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;

Thanks for any help.

1

There are 1 best solutions below

0
On

You can press enter without typing anything and it will subscribe the state . If that won't works then follow bellow steps.

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!

cretaeStore.ts

 import Reactotron from '../../ReactotronConfig';
     
    const sagaMonitor = Reactotron.createSagaMonitor();
    const sagaMiddleware = createSagaMiddleware({ sagaMonitor });
    
    const store = createStore(rootReducer, compose(...enhancers, Reactotron.createEnhancer()));

Above code is from my file , but your configuration seems little different . Please follow bellow two steps

  1. Step 1 - Follow till If you have middleware
  2. Step 2 - follow if you are using saga.