Created
May 27, 2021 09:58
-
-
Save RealDyllon/c6aefa083d071a237fb4ec94d9111bed to your computer and use it in GitHub Desktop.
React Native Redux store with reactrotron debugging in DEV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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