'the symetric function as useRoutesMatch react-router-dom v5 in react-router-dom v6

i want my application routes as good as well between the component so I had use the old tools "useRoutesMatch" version of v5 but actually I had installed the v6 react-router-dom so the last version functions don't work with the new version so what's the synonym function that work the same work as useRoutesMatch in v6.there's my code:

function QuizRoutes() {
  let location = useRoutesMatch();

  return (
    <>
      <Routes>
        <Route path={`${location.path}/new`} element={<NewQuizForm />} >
          
        </Route>
        <Route path={`${location.path}/:quizId`} element={<Quizz />} >
          
        </Route>
        <Route path={`${location.path}`} element={<Quizzes />} >
          
        </Route>
      </Routes>
    </>
  );
}
export default App;


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source