How can I add an indefinite amount of parameters in react router dom v6?

Viewed 18

I am developing a to-do list app and I want the URL to also indicate the folder you are in. For example if the URL says "localhost:3000/home/room" It means that you are in the "room" folder which is inside the "home" folder. However, I don't know how to take the 2 parameters without defining them manually, it only takes 1:

 //Routes.js
 <Route path='/test/:params' element={<Test/>} />
 //Test.js
const Prueba = () => {

    const params = useParams();

    console.log(params);
  return (
    <div>Prueba</div>
  )
}

If I enter the URL "localhost:5000/Home" the console.log correctly returns me that the parameter "params" exists and the value is "Home". But if I go to "localhost:5000/home/room" it tells me that the path "/home/room" is not found Is there a way to useParams to return parameters without declaring them in Routes.js

0 Answers
Related