title: React exporting withRouter and withStyles error
body: <p>I am using react along with redux and material-ui to make a component.  I am attempting to write an export statement <code>export default connect()(withRouter(FirstPage))(withStyles(styles)(FirstPage))</code></p>
  
  <p>However, this doesn't seem to work I get an error that says </p>
  
  <p><code>TypeError: Cannot set property 'props' of undefined</code></p>
  
  <p><code>this.props = props;</code></p>
  
  <p>This error is referencing one of my node_modules.</p>
  
  <p>Here is my full code:</p>
  
  <pre><code>import React, { Component } from 'react';
  import { connect } from 'react-redux';
  import {withRouter} from 'react-router-dom'
  import { withStyles } from '@material-ui/core/styles';
  import Card from '@material-ui/core/Card';
  import CardActions from '@material-ui/core/CardActions';
  import CardContent from '@material-ui/core/CardContent';
  import Button from '@material-ui/core/Button';
  
  const styles = theme =&gt;({
      root: {
          maxWidth: 345,
      },
  
  })
  class FirstPage extends Component {
      state = {
          feeling: ''
      }
  
      //This function will dispatch the users response to index.js
      //The dispatch type here is 'SET_FEELING'
      submitData=(event) =&gt; {
          event.preventDefault();
          this.props.dispatch({type: 'SET_FEELING', payload: this.state})
          this.changeLocation();
      }
  
      //This function will update the local state with the users response
      handleChange= (event) =&gt; {
          this.setState({
              feeling: event.target.value
          })
      }
  
      //This function will change the current url when a button is clicked
      changeLocation= ()=&gt; {
          this.props.history.push('/secondPage')
      }
  
      render(){
          const { classes } = this.props;
  
          return(
              &lt;div&gt;
                  &lt;Card &gt;
                      &lt;CardContent className={classes.root}&gt;
  
                          &lt;form&gt;
                          &lt;input onChange={this.handleChange} placeholder='How are you feeling' value={this.state.feeling} /&gt;
                          &lt;/form&gt;
                      &lt;/CardContent&gt;
                      &lt;CardActions&gt;
                          &lt;Button onClick={this.submitData}&gt;Submit&lt;/Button&gt;
                      &lt;/CardActions&gt;
                  &lt;/Card&gt;
              &lt;/div&gt;
          )
      }
  }
  
  //this export connects the component to the reduxStore as well as allowing us to use the history props
  export default connect()(withRouter(FirstPage))(withStyles(styles)(FirstPage))
  </code></pre>