title: Change route after submit form in react with typescript
body: <p>I am new in react. I write react with typescript without redux.
  In my sample project i want after submit form, change route, but i can not do this. following code is my try. how can I change route in fetch then function? why this value is undefined!</p>
  
  <pre><code>import * as React from 'react';
  import 'isomorphic-fetch';
  import { ReactRouter } from 'react-router-dom';
  
  export interface Props {router?: ReactRouter.History.History;}
  
  interface State {name: string;}
  
  export class CreateItem extends React.Component&lt;Props, State&gt; {
  
      private input: HTMLInputElement;
  
      constructor(props: Props) {
  
          super(props);
  
          this.state = {name: ""};
  
          this.input = null;
      }
  
      public render(){
  
          return &lt;form onSubmit={this.handleSubmit} className="form-horizontal"&gt;
              &lt;div className="form-group"&gt;
                  &lt;label className="col-sm-2 control-label"&gt;Date&lt;/label&gt;
                  &lt;div className="col-sm-5"&gt;
                      &lt;input name="name" type="text" value={this.state.name} onChange={this.handleInputChange} className="form-control"&gt;
                      &lt;/input&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
  
              &lt;div className="form-group"&gt;
                  &lt;div className="col-sm-offset-2 col-sm-5"&gt;
                      &lt;button type="submit" className="btn btn-default" disabled={!this.state.name}&gt;ADD&lt;/button&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/form&gt;;
      }
  
      private handleSubmit = (event: React.FormEvent&lt;HTMLFormElement&gt;): void =&gt; {
  
          event.preventDefault();
  
          if (this.state.name) {
  
              var form = new FormData();
  
              form.append('name', name);
  
              fetch('/api/SampleData/', { method: 'POST', body: form })
                  .then(function (res) {
                      this.props.history.push('/fetchdata');// **this code not work**
                  });
  
              this.setState({
                  name: ""
              });
          }
      }
  
      private handleInputChange = (event: React.FormEvent&lt;HTMLInputElement&gt;): void =&gt; {
  
          const target = event.target;
          const name = target["name"];
  
          this.setState({
              [name]: (event as any).target.value
          })
      }
  }
  </code></pre>