Skip to content

Instantly share code, notes, and snippets.

@RealDyllon
Created May 27, 2021 09:58
Show Gist options
  • Save RealDyllon/c6aefa083d071a237fb4ec94d9111bed to your computer and use it in GitHub Desktop.
Save RealDyllon/c6aefa083d071a237fb4ec94d9111bed to your computer and use it in GitHub Desktop.
React Native Redux store with reactrotron debugging in DEV
import { applyMiddleware, compose, createStore } from 'redux'
import thunk from 'redux-thunk'
import reducers from 'reducers'
const middleware = [thunk]
let enhancers
// eslint-disable-next-line
if (__DEV__) {
const Reactotron = require('./reactotronConfig').default // conditionally import without async
enhancers = compose(
applyMiddleware(...middleware),
Reactotron.createEnhancer(),
)
} else {
// in production envs:
enhancers = applyMiddleware(...middleware)
}
const store = createStore(reducers, enhancers)
export default store
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment