title: react redirect to another page not working
body: <p>I want to redirect to home page after successful login.I searched throughly but didn't find the solution to this. Thanks in advance</p>
  
  <pre><code>//imported react-router
  import { Redirect } from 'react-router';
  
  //main route file
  &lt;Router&gt;
    &lt;div&gt;
      &lt;Route exact path = "/" component={ App } /&gt;
      &lt;Route path = "/home" component={ Homepage } /&gt;
    &lt;/div&gt;
  &lt;/Router&gt;
  
  //redirect after ajax success
  $.ajax({
      type: 'POST',
      url: '/login_participant',
      data: data,
      dataType:'json',
      success:function(data) {
           console.log(data);
  
           //redirecting home after login successfully
           &lt;Redirect to ="/home" /&gt;
      },
      error:function(err) {
           console.log(err);
      }
  })
  </code></pre>