title: how to call function on any route inside react router?
body: <p>I am building a react/redux/thunk application. I have some routes working and rendering components. Currently I have a <code>Routes</code> file with all my routes that I render inside my ReactDOM.</p>
  
  <p>it is a shop application that I want to sync with my server so that when ever the app loads, it loads the application with the correct stuff from the database. so if someone has products in their basket I want them to be in the basket when the app loads</p>
  
  <p>I'm struggling of thinking of a way to do this. I was thinking of calling it in <code>componentDidMount</code> but that only gets called for the particular component, so if the user was to hit a different route then it wouldn't be called and there basket wouldn't be synced. so is there a way to call a function on every route change? or a different solution to my problem?</p>