title: React Router v4 - How to detect back button navigation vs url refresh?
body: <p>I have a url at <code>/page</code> <strong>(PAGE A)</strong> where I want to detect if the page was navigated to with history back from <strong>(PAGE B)</strong> or if the user was on <strong>(PAGE A)</strong> and manually refreshed the page from the URL bar refresh button (without using history back).</p>
  
  <p>I looked into all the history, location, props by react router but didn't find a way to differentiate how the user navigated to the page.</p>
  
  <p>In both scenarios, the <code>history.action == 'POP'</code> is the history action. Ideally it would be <code>'POP'</code> when using the back button in the app to go back from page b to page a, and when on page a, when refreshing the page, it would be something other than <code>'POP'</code> like <code>'REFRESH'</code> for example.</p>
  
  <p>How can we differentiate between both of them to run different logic in our app, since both trigger <code>'POP'</code>?</p>