title: How to listen to page url change in React?
body: <p>I have a react component that is rendered in two different pages and I want it to have different css for each page. So I passed it a prop to switch between the css classes, but, because there is no page refresh between the 2 pages, my component doesn't change the css class, only if I manually refresh the page, my component sees the prop I passed and changes the css class.
  Can anyone tell me how can I make the component rerender on page change ? even if there is no page refresh?
  I tried, until now, to change the state of the component with componentDidUpdate, but it ends up rerendering on a infinite loop, and the page doesn't load anymore.</p>
  <p>Is there any other way to do this ?</p>