5

I decided to add the RNDebugger and Redux Devtools Extension packages to my app for help debugging and for later testing with redux persist (which I haven't implemented yet). Thus, I am now using the the following packages for my React Native app's state architecture: React Redux, Redux, Redux Thunk, RNDebugger, and Redux Devtools Extension. The RNDebugger and Redux Devtools Extension was installed as a dev dependency, per their docs. I am using the composeWithDevTools function when creating my redux store. So I am wondering, do I have to install the RNDebugger and Redux Devtools Extension as production dependencies instead since the composeWithDevTools function is part of the Redux Devtools Extension package? I do not wish to use the debugger in Production, but I also don't want the app to fail when it goes to Production because the composeWithDevTools function is unknown. My code is working correctly and I can see the redux store in the RNDebugger (nice!). Nonetheless, this my basic setup:

// Store.js
import { createStore, applyMiddleware } from 'redux';
import { composeWithDevTools } from "redux-devtools-extension";
import ReduxThunk from 'redux-thunk';
import reducers from '@reducers/';

export default createStore(
  reducers,
  composeWithDevTools(
    applyMiddleware(ReduxThunk)
  )
);

// App.js
import React, { Component } from 'react';
import { Provider } from 'react-redux';
import Store from './Store';
import Router from './Router';

class App extends Component {
    render() {
        return (
            <Provider store={Store}>
                <Router />
            </Provider>
        );
    }
}

export default App;
drquiz
  • 161
  • 2
  • 6
  • BTW, I noticed that I can use 'redux-devtools-extension/developmentOnly' when importing the composeWithDevTools function so that it's only used for dev purposes and not prod, but I'm still not clear if the redux-devtools-extension package should be install as a dev dependency or a production app dependency. – drquiz Mar 20 '19 at 20:31
  • 2
    IMHO it should not be a dev dependency since you are importing it in the source of the app, even if you import it as `developmentOnly`. – aromero Jun 25 '19 at 21:41
  • @aromero That's exactly what I ended up concluding as well. Thanks for the confirmation! – drquiz Jun 26 '19 at 22:04

0 Answers0