title: React: Close sidebar menu on route change
body: <p>I want to close sidebar menu when the user has selected a new target URL. With react-router-dom, how can I detect when the user navigates to a new page?</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code> &lt;div className="" id="rightMenu"&gt;
      &lt;div className="sidebar_link"&gt;
        &lt;a href="#" id="personal_account"
            onClick={() =&gt;
            this.props.history.push('/personal-account')}
                 Personal Account
                 &lt;/a&gt;
      &lt;/div&gt;
       &lt;div</code></pre>
  </div>
  </div>
  </p>