title: Rewriting code with useParams, deconstructuring not going well
body: <p>Trying to upgrade react router to version 5.1.
  I have a problem with the useParams, the <code>exampleId</code> is not correct. I'm definatelly missing something?
  My Route file with the broken <code>exampleId</code>:</p>
  <pre><code>export default function MyExample() {
    const { url } = useRouteMatch()
    const history = useHistory()
    const exampleCreateQuery = useExampleCreate()
  
    return (
      &lt;&gt;
        &lt;Header url={url} /&gt;
  
        &lt;Switch&gt;
          &lt;Route path={url} exact&gt;
            
          &lt;/Route&gt;
          
          &lt;Route path={`${url}/:id`} children={exampleId !== undefined ? &lt;ExampleThing exampleId={exampleId} /&gt; : null} /&gt;
        &lt;/Switch&gt;
      &lt;/&gt;
    )
  }
  
  </code></pre>
  <p>The route where the id comes from</p>
  <pre><code>export default function ExampleThing() {
    const { id: exampleId } = useParams&lt;{ id: string }&gt;()
    const exampleQuery = useExample(exampleId, { useErrorBoundary: false })
   
    return (
      &lt;&gt;
      &lt;/&gt;
    )
  }
  </code></pre>