title: React redirection and transfering info to another page
body: <p>I have a react applictation with react-router for navagation. I try to create form that is update some data. After submit the data are send to server though ajax request and in case of ajex response is "Ok" than the user has to be redirected to another page (in my case url in react-router is <code>/carwash</code>) and information about succesfull update has to be shown in the distination page. </p>
  
  <p>I tried to do this by 3 differect ways:</p>
  
  <p>1)  <code>this.props.history.push('/carwash')</code> The result was exception:<code>Uncaught TypeError: Cannot read property 'push' of undefined</code></p>
  
  <p>2) <code>browserHistory.push("/carwash")</code>, the result is the list in browser was changed but there isn't any redirection</p>
  
  <p>3) redirection on absolute url w/o react: <code>window.location.replace("/owner.html#/carwash")</code>, the result was succesfull but I don't undestand how to inform destitaion page the data was update succesfull.</p>
  
  <p>Can you explain me what is the best way for redirection in react and how to use it? And what is not less important how to infom page where the user will be redirected that the data was update succefull ?</p>
  
  <p>My code has the following view:</p>
  
  <pre><code>import React from 'react';
  import {Router} from 'react-router';
  import Loading from './form/loading.jsx';
  
  export default class EditCarWashForm extends React.Component{
  
  static contextTypes = {
      router: React.PropTypes.object.isRequired
  };
  
  constructor(props) {
      super(props);
      this.state = {
          name        :  {value : constants.EMPTY_FIELD, isValid : false},
          address     :  {value : constants.EMPTY_FIELD, isValid : true},
          isCarWashDownload : true
      };
      this.handleSubmit = this.handleSubmit.bind(this);
  }
  
  handleSubmit(e) {
      e.preventDefault();
      let carWashData = {some logic}
  
      $.ajax({
          url: '/carwash/',
          type: 'POST',
          async: true,
          cache: false,
          contentType: 'application/json',
          data: JSON.stringify(carWashData),
          dataType: 'json',
          success: function(data) {
              if (data.message == 'Ok'){
                 // browserHistory.push("/owner.html#/carwash")
                  this.props.history.push('/carwash');
                 // window.location.replace("/owner.html#/carwash");
          }
          }.bind(this),
      })
  };
  
  
  render(){
      let data = &lt;Loading/&gt;
  
      if (this.state.isCarWashDownload) {
          data =
              &lt;form onSubmit={this.handleSubmit} id="addCarWashForm"&gt;
                  &lt;FormInputField
                      title="Name*:"
                      placeholder="Name"
                      name="name"
                      required={true}
                      maxLength={50}
                      defaultValue={this.state.name.value}
                  /&gt;
  
                  &lt;FormInputField
                      title="Adress:"
                      placeholder="Adress"
                      name="address"
                      maxLength={200}
                  /&gt;
  
  
                  &lt;div className="form-group"&gt;
                      &lt;div className="col-sm-offset-2 col-sm-10"&gt;
                          &lt;button type="submit"&gt;Update&lt;/button&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
  
              &lt;/form&gt;
      }
  
      return (
          &lt;div&gt;
              {data}
          &lt;/div&gt;
      )
  
  }
  </code></pre>
  
  <p>}</p>