Error reactotron createStore is not function

535 Views Asked by At

I have a sample code use this packages:

  • reactotron-react-native
  • reactotron-redux
  • reactotron-redux-saga

file index.js

...
import "./ReactotronConfig";
...
const createAppropriateStore = __DEV__ ? console.tron.createStore : createStore;
const store = createAppropriateStore(reducers, applyMiddleware(...middleware));

file ReactotronConfig.js

import Reactotron from "reactotron-react-native";
if (__DEV__) {
  const tron = Reactotron.configure({ host: "192.168.1.17" })
    .useReactNative()
    .connect();

  tron.clear();

  console.tron = tron;
}

Result show this bug

bug

But if I replace console.tron.createStore to createStore it will work again

1

There are 1 best solutions below

2
On

You can try this

import "./ReactotronConfig";
import Reactotron from 'reactotron-react-native'
...
const createAppropriateStore = !__DEV__ ? console.tron.createStore : Reactotron.createStore;
const store = createAppropriateStore(reducers, applyMiddleware(...middleware));