title: How to get the last part of the current URL with react router v6?
body: <p>How can I get the last part of the current url with react router v6?</p>
  <p>For example:</p>
  <p>If the current path is <code>https://localhost:4200/example/example-details</code>, then I want to check it like this</p>
  <pre><code>const location = useLocation();
  
  if (location.pathname === '/example-details')) {
    // do some stuff here
  }
  </code></pre>
  <p>..but this always returns the full path.</p>
  <p>It works with <code>location.pathname.includes('/example-details')</code>, but I'm curious if there is a way with the react router, like it is possible with the Angular router..</p>