title: Detecting user leaving page with react-router
body: <p>I want my ReactJS app to notify a user when navigating away from a specific page. Specifically a popup message that reminds him/her to do an action:</p>
  
  <blockquote>
    <p>"Changes are saved, but not published yet. Do that now?"</p>
  </blockquote>
  
  <p>Should i trigger this on <code>react-router</code> globally, or is this something that can be done from within the react page / component?</p>
  
  <p>I havent found anything on the latter, and i'd rather avoid the first. Unless its the norm of course, but that makes me wonder how to do such a thing without having to add code to every other possible page the user can go to..</p>
  
  <p>Any insights welcome, thanks!</p>