title: What is withRouter for in react-router-dom?
body: <p>
  I've <a href="https://github.com/lore/www.lorejs.org/blob/41f9b34a67cb676984daf0cda4126a6bf4e14fcd/src/pages/cli/lore-generate-component/options/router.js" rel="noreferrer">sometimes seen</a> people wrap their components in <code>withRouter</code> when they are exporting them:</p>
  
  <pre class="lang-js prettyprint-override"><code>import { withRouter } from 'react-router-dom';
  
  class Foo extends React.Component {
    // ...
  }
  
  export default withRouter(Foo);
  </code></pre>
  
  <p>What is this for, and when should I use it?</p>