title: Uncaught TypeError: Cannot read property 'push' of undefined with correct import being available
body: <p>I am using <code>react-router</code> and have seen the other questions asked already. May be I am blind or this may be a valid issue.</p>
  
  <p><code>index.js</code> has</p>
  
  <pre><code>const Root = () =&gt; (
      &lt;MuiThemeProvider&gt;
          &lt;Router history={browserHistory}&gt;
              &lt;div&gt;
                  &lt;Route path="/" component={App}/&gt;
                  &lt;Route path="/menu" component={Menu}/&gt;
                  &lt;Route path="/summary" component={Summary}/&gt;
                  &lt;Route path="/menuDetail/:id" component={MenuDetail}/&gt;
                  &lt;Redirect from="/" to="/summary"/&gt;
              &lt;/div&gt;
          &lt;/Router&gt;
      &lt;/MuiThemeProvider&gt;
  );
  </code></pre>
  
  <p><code>MenuDetail.js</code> looks like</p>
  
  <pre><code>import React from 'react';
  
  const MenuDetail = ({match}) =&gt; (
      &lt;div&gt;
          &lt;h3&gt;Menu Id: {match.params.id}&lt;/h3&gt;
      &lt;/div&gt;
  );
  
  export default MenuDetail;
  </code></pre>
  
  <p>in <code>SpicyMenu.js</code> I do  </p>
  
  <pre><code>import { browserHistory } from 'react-router';
  class SpicyMenuItem extends React.Component {
      constructor(props) {
          super(props);
  
          this.fetchMenuItem = this.fetchMenuItem.bind(this);
      }
  
      fetchMenuItem(menuId) {
          return () =&gt; {
              console.log("fetching menu with id: " + menuId);
              browserHistory.push('/menuDetail/' + menuId);
          }
  
      }
      render() {
          return (
              &lt;ListItem onClick={this.fetchMenuItem(this.props.id)}&gt;
                  &lt;Grid fluid&gt;
                      &lt;Row center="lg" style={RowItemStyle}&gt;
                          &lt;Col xs={3} sm={3} lg={2}&gt;&lt;Avatar src={this.props.image}/&gt;&lt;/Col&gt;
                          &lt;Col xs={6} sm={6} lg={4}&gt;{this.props.name}&lt;/Col&gt;
                          &lt;Col xs={3} sm={3} lg={2}&gt;{this.props.price}&lt;/Col&gt;
                      &lt;/Row&gt;
                  &lt;/Grid&gt;
              &lt;/ListItem&gt;
          );
      }
  }
  </code></pre>
  
  <p>But when I run this and click on a <code>ListItem</code>, it gives me the following</p>
  
  <pre><code>SpicyMenu.js:45 Uncaught TypeError: Cannot read property 'push' of undefined
      at Object.onClick (http://localhost:3000/static/js/bundle.js:78878:45)
      at EnhancedButton._this.handleClick (http://localhost:3000/static/js/bundle.js:42799:22)
      at Object.ReactErrorUtils.invokeGuardedCallback (http://localhost:3000/static/js/bundle.js:17230:17)
      at executeDispatch (http://localhost:3000/static/js/bundle.js:17013:22)
      at Object.executeDispatchesInOrder (http://localhost:3000/static/js/bundle.js:17036:6)
      at executeDispatchesAndRelease (http://localhost:3000/static/js/bundle.js:16424:23)
      at executeDispatchesAndReleaseTopLevel (http://localhost:3000/static/js/bundle.js:16435:11)
      at Array.forEach (native)
      at forEachAccumulated (http://localhost:3000/static/js/bundle.js:17333:10)
      at Object.processEventQueue (http://localhost:3000/static/js/bundle.js:16638:8)
      at runEventQueueInBatch (http://localhost:3000/static/js/bundle.js:24260:19)
      at Object.handleTopLevel [as _handleTopLevel] (http://localhost:3000/static/js/bundle.js:24271:6)
      at handleTopLevelImpl (http://localhost:3000/static/js/bundle.js:29372:25)
      at ReactDefaultBatchingStrategyTransaction.perform (http://localhost:3000/static/js/bundle.js:19844:21)
      at Object.batchedUpdates (http://localhost:3000/static/js/bundle.js:29287:27)
      at Object.batchedUpdates (http://localhost:3000/static/js/bundle.js:18463:28)
      at dispatchEvent (http://localhost:3000/static/js/bundle.js:29447:21)
  </code></pre>
  
  <p>The specific commit for this change is <a href="https://github.com/hhimanshu/spicyveggie/commit/0532b9d7ea16d7f7f672973bedcf4109f4aa4dcf" rel="nofollow noreferrer">https://github.com/hhimanshu/spicyveggie/commit/0532b9d7ea16d7f7f672973bedcf4109f4aa4dcf</a>
  and the complete code is available at <a href="https://github.com/hhimanshu/spicyveggie/tree/menu_detail" rel="nofollow noreferrer">https://github.com/hhimanshu/spicyveggie/tree/menu_detail</a></p>
  
  <p>Thanks</p>