title: React-Router V6 check if path matches a pattern
body: <p>I'm trying to check a "/admin/posts/new" to "/admin/*" in react-router v6. I found that there is a matchRoutes function</p>
  
  <pre><code>import { useLocation } from "react-router";
  const { pathname } = useLocation();
  const isAdminPath = someMatchFunc(pathname,"/admin/*") &lt;&lt;&lt;&lt; something goes here returns true or null
  </code></pre>