title: Pass id as props in react-router-dom
body: <p>I would like to pass an ID in props to a component react
  I use react-router-dom
  Here is my app.js file</p>
  
  <pre><code>          &lt;Switch location={this.props.location}&gt;
          &lt;Route exact path="/" component={Home} /&gt;
          &lt;Route path="/list" component={List} /&gt;
          &lt;Route path='/img/:imgId' component={() =&gt; &lt;Img imgId={this.props.params.imgId}/&gt;} /&gt;
        &lt;/Switch&gt;
  </code></pre>
  
  <p>When I go to the next url img / 2, the router sends me the right page, but the id is not present in the props.
  When I look into react developer tools on chrome, I can see that</p>
  
  <pre><code>&lt;Switch&gt;
   &lt;Route&gt;
    &lt;component&gt;
     &lt;Img&gt;
     &lt;/Img&gt;
    &lt;/component&gt;
   &lt;/Route&gt;
  &lt;/Switch&gt;
  </code></pre>
  
  <p>In the component called component, I have something in props.match.params.imgId
  But when I go on the Img component, here is what I have as props:
  imgId: {empty object}</p>
  
  <p>Do you know how to recover the id in parameter?</p>
  
  <p>Thanks :)</p>