title: React-Router & MobX - Provider
body: <p>I am trying to access my store from every component page I have, so I followed the following tutorial in order to connect React Router &amp; MobX.</p>
  
  <p><a href="http://frontendinsights.com/connect-mobx-react-router/" rel="noreferrer">http://frontendinsights.com/connect-mobx-react-router/</a></p>
  
  <p>However, I am facing a problem at <strong>The MobX way – Provider component</strong>.</p>
  
  <p>This is the code exmaple:</p>
  
  <pre><code>import { Provider } from 'mobx-react';
  import usersStore from './stores/usersStore';
  import itemsStore from './stores/itemsStore';
  
  const stores = { usersStore, itemsStore };
  
  ReactDOM.render(
    &lt;Provider {...stores}&gt;
      &lt;Router history={history}&gt;
        &lt;Route path="/" component={App}&gt;
        &lt;/Route&gt;
      &lt;/Router&gt;
    &lt;/Provider&gt;,
    document.getElementById('app')
  );
  </code></pre>
  
  <p>I tried to do the same in <code>index.js</code></p>
  
  <pre><code>import React from 'react'
  import { render } from 'react-dom'
  import { Router, hashHistory, Route, IndexRedirect } from 'react-router'
  import App from './webapp/App'
  import Home from './components/pages/Home'
  import Dogs from './components/pages/Dogs'
  import Cats from './components/pages/Cats'
  import Provider from 'mobx-react'
  import RootStore from './webapp/stores'
  
  const store = RootStore
  
  render((
    &lt;Provider rootStore={store}&gt;
      &lt;Router history={hashHistory}&gt;
          &lt;Route path="/" component={App}&gt;
            &lt;IndexRedirect to="/home" /&gt;
            &lt;Route path="/home" component={Home}/&gt;
            &lt;Route path="/dogs" component={Dogs}/&gt;
            &lt;Route path="/cats" component={Cats}/&gt;
          &lt;/Route&gt;
        &lt;/Router&gt;
      &lt;/Provider&gt;
  ), document.getElementById('app'))
  </code></pre>
  
  <p>However, because of <code>&lt;Provider/&gt;</code>, I am getting an error:</p>
  
  <blockquote>
    <p>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).</p>
  </blockquote>
  
  <p>Why am I getting that? It should work doesn't it?</p>
  
  <p>Thanks for any help !</p>