undefined is not an object evaluating console.tron.createSagaMonitor

918 Views Asked by At

I'm trying to connect to api in react native and I'm using Redux and reactotron to monitor. He is returning this error to me below, I have already updated the libraries and so far I cannot identify the error.

import { persistStore } from 'redux-persist';
import createSagaMiddleware from 'redux-saga';

import createStore from './createStore';
import persistReducers from './persirstReducers';

import rootReducer from './modules/rootReducer';
import rootSaga from './modules/rootSaga';

const sagaMonitor = __DEV__ ? console.tron.createSagaMonitor() : null;

const sagaMiddleware = createSagaMiddleware({ sagaMonitor });

const middlewares = [sagaMiddleware];

const store = createStore(persistReducers(rootReducer), middlewares);
const persistor = persistStore(store);

sagaMiddleware.run(rootSaga);

export { store, persistor };

enter image description here

2

There are 2 best solutions below

0
On

you need to add sagaPlugin like docs say

I have the same problem and I figured out that it needs sagaPlugin to be use

0
On

You possibly didn't import ReactotronConfig in App.js, I had the same problem and it worked for me.

Example:

import './src/config/ReactotronConfig';
import store from './src/store';

export default function App() {
 return (
    <>
      <Provider store={store}>
        <Background>
          <StatusBar
            barStyle="light-content"
            backgroundColor="transparent"
            translucent
          />
          {fontsLoaded ? <Routes /> : <Loading />}
        </Background>
      </Provider>
    </>
  );
}