Redirection in reactjs
<p>I have a problem which i couldn't solve it for a while. I have mvc application which will render a login page upon successful login i have to redirect to a particular page.</p>

<p>The login authentication is done by Api controller which will give me a json bit on successful authentication.I have a question on how to do redirection on successful login.I am using ecmascript 5 specs. I have not inherited layout in my login form and all the components and routes are in scripts registered in layout page.This login is kind of temporary page and below is the jsx code for login.Timely help will be appreciated</p>

<pre><code>var MyInput = React.createClass({
//onchange event
handleChange: function (e) {
    this.props.onChange(e.target.value);
    $("#diverror span").removeClass('alert');
    $("#diverror span").removeClass('alert-danger');
},
componentDidMount: function () {
    if (this.props.onComponentMounted) {
        this.props.onComponentMounted(this);//register this input in the           form
    }
},    

render: function () {
    var inputField;
        inputField = &lt;input type={this.props.type} value={this.props.value} ref={this.props.name} name={this.props.name}
        className='form-control'  onChange={this.handleChange} /&gt;            
    return (
            &lt;div className="form-group"&gt;
                &lt;label htmlFor={this.props.htmlFor}&gt;{this.props.label}&lt;/label&gt;
    {inputField}
&lt;/div&gt;
        );
}
</code></pre>

<p>});</p>

<pre><code>var Router = ReactRouter;
var Route = ReactRouter.Route;
var Routes = ReactRouter.Routes;
var Navigation = ReactRouter.Navigation;
var History = ReactRouter.History;

var LoginForm = React.createClass({
mixins: [History],
mixins: [Navigation],

//get initial state enent
getInitialState: function () {
    return {
        EnterpriseId: '',
        Password: 'ALWTempReplatform',
    }
},
//handle change full name
onChangeEnterpriseId: function (value) {
    this.setState({
        EnterpriseId: value
    });
},
//handle chnage email
onChangePassword: function (value) {
    this.setState({
        Password: value
    });
},
// submit function
handleSubmit: function (e) {
    e.preventDefault();
        enterpriseId = this.state.EnterpriseId;
        this.serverRequest = $.ajax({

            //url: this.props.urlPost,
            url: '/api/LoginApi/Login',
            dataType: 'json',
            cache: false,
            data: enterpriseId,
            data: { enterpriseId: enterpriseId },
            success: function (data) {
                //Will clear form here
                this.setState({
                    EnterpriseId: '',
                    Password:''
                });

                if (data == 0)
                {
                    history.pushState({}, '', '/')
                    window.location.reload()
                }
                else
                {
                    $("#diverror span").text("Access Denied");
                    $("#diverror span").addClass('alert');
                    $("#diverror span").addClass('alert-danger');

                }
            }.bind(this),
            error: function (e) {
                console.log(e);
                //alert('Error! Please try again');
            }
        });

},
render : function(){
    //Render form 
    return(
        &lt;form name="loginForm" noValidate onSubmit={this.handleSubmit}&gt;
            &lt;div className="container"&gt;
                &lt;div className="row"&gt;
                       &lt;div className="col-md-3"&gt;&lt;/div&gt;
            &lt;div className="col-md-6 divformbtncontainer"&gt;
                &lt;div className="formcontroldiv"&gt;
            &lt;MyInput type={'text'} value={this.state.EnterpriseId} label=  {'Enterprise Id'} name={'EnterpriseId'} htmlFor={'EnterpriseId'}
                     onChange={this.onChangeEnterpriseId}   /&gt;
            &lt;MyInput type={'password'} value={this.state.Password} label={'Password'} name={'Password'} htmlFor={'Password'} 
                     onChange={this.onChangePassword}   /&gt;
     &lt;button type="submit" className="btn btn-primary btn-signin"&gt;SIGN IN&lt;/button&gt;
                &lt;/div&gt;
            &lt;/div&gt;
                    &lt;div className="col-md-3"&gt;&lt;/div&gt;
                &lt;/div&gt;
                &lt;div className="row"&gt;
                      &lt;div className="col-md-3"&gt;&lt;/div&gt;
                       &lt;div id="diverror" className="col-md-6 error"&gt;
                           &lt;span&gt;&lt;/span&gt;
                       &lt;/div&gt;
                    &lt;div className="col-md-3"&gt;&lt;/div&gt;
                &lt;/div&gt;
            &lt;/div&gt;


&lt;/form&gt;
    );
}
});

//Render react component into the page
ReactDOM.render(&lt;LoginForm /&gt;, document.getElementById('divLoginForm'));
</code></pre>