title: window.location.href vs history.pushState - which to use?
body: <p>I've been teaching myself <code>react-router</code>, and now I'm wondering which method should be used for going to another page.</p>
  
  <p>According to <a href="https://stackoverflow.com/questions/31079081/programmatically-navigate-using-react-router">this post (Programmatically navigate using react router)</a>, you can go to another page by <code>this.props.history.push('/some/path')</code>.</p>
  
  <p>Honestly, however, I'm not quite sure about the differences between <code>window.location.href</code> and <code>history.pushState</code>.</p>
  
  <p>As far as I understand, <code>window.location.href = "/blah/blah";</code> leads you to anther page by making a new HTTP call, which refreshes the browser.</p>
  
  <p>On the other hand, what <code>history.pushState</code> (and <code>this.props.history.push('/some/path')</code>) does is to <strong>push a state</strong>. This, apprently, changes HTTP referrer and consequently updates <code>XMLHttpRequest</code>.</p>
  
  <p>Here is an excerpt from <a href="https://developer.mozilla.org/en-US/docs/Web/API/History_API" rel="noreferrer">mozila's documentation...</a></p>
  
  <blockquote>
    <p>Using history.pushState() changes the referrer that gets used in the HTTP header for XMLHttpRequest objects created after you change the state. </p>
  </blockquote>
  
  <p>To me, it sounds like both methods make a new HTTP call. If so, what are the differences?</p>
  
  <p>Any advice will be appreciated.</p>
  
  <p><strong>PS</strong></p>
  
  <p>I thought that developers would need to consider whether it's necessary to get data from the server, before deciding how to go to another page.</p>
  
  <p>If you need to retrieve data from the server, <code>window.location.href</code> would
  be fine, since you'll make a new HTTP call. However, if you are using <code>&lt;HashRouter&gt;</code>, or you want to avoid refreshing you page for the sake of speed, what would be a good approach?</p>
  
  <p>This question led me to make this post.</p>