Delaying Render of root component in React errors w/ Hot Reloading
<p>I need to delay the root app component until my redux store autoHydrates using <a href="https://github.com/rt2zz/redux-persist" rel="nofollow">redux-persist</a>. But using this code causes error in development when using Hot Reloading:</p>

<pre><code>const App = () =&gt; (
    &lt;MuiThemeProvider&gt;
      &lt;Provider store = {store}&gt;
        {getRoutes(checkAuth, history)}
      &lt;/Provider&gt;
    &lt;/MuiThemeProvider&gt;
    )

class AppProvider extends Component {

  constructor () {
    super()
    this.state = { rehydrated: false }
  }

  componentWillMount () {
    persistStore(store, {storage: localforage}, () =&gt; {
      this.setState({ rehydrated: true })
    })
  }

  render () {
    if (!this.state.rehydrated) {
      return &lt;div&gt;Loading...&lt;/div&gt;
    }
    return (
      &lt;App /&gt;
    )
  }
}

ReactDOM.render(
    &lt;AppProvider/&gt;,
  document.getElementById('app')
)
</code></pre>

<p>If I change it to just this, It works(no error at Hot reloading): </p>

<pre><code>const App = () =&gt; (
    &lt;MuiThemeProvider&gt;
      &lt;Provider store = {store}&gt;
        {getRoutes(checkAuth, history)}
      &lt;/Provider&gt;
    &lt;/MuiThemeProvider&gt;
    )

ReactDOM.render(
    &lt;App/&gt;,
  document.getElementById('app')
)
</code></pre>

<p>I tried something using process.env.NODE_ENV to check if its 'production' or 'development' so I can run the above code snippets conditionally, however, for some reason it still causes that error if I add the stateful component snippet in the condition to only run if process.env.NODE_ENV === 'development'
<strong>I get the following errors when i change something in a component that render in HomeConatiner:</strong></p>

<blockquote>
  <p>warning.js:36 Warning: React.createElement:
  type should not be null, undefined, boolean, or number. It should be a
  string (for DOM elements) or a ReactClass (for composite components).
  Check the render method of <code>HomeContainer</code>.</p>
  
  <p>Uncaught Error: Element type is invalid: expected a string (for
  built-in components) or a class/function (for composite components)
  but got: undefined. Check the render method of <code>HomeContainer</code>.(…)</p>
</blockquote>