I am unable to get the props from the nested routes, Products route has nested route which should print pc but I only get ssd,
Is this because I am using same component in the nested route ? or I am doing something wrong.
App.js
<BrowserRouter>
<div className="app">
<Header />
<Routes>
<Route index element={<Home />} />
<Route path="/about" element={<About />} />
<Route path="/contact" element={<Contact />} />
<Route path="products" element={<Products name="ssd"/>}>
<Route path=":id" element={<Products ye="pc" />} />
</Route>
<Route path="*" element={<Err />}/>
</Routes>
</div>
</BrowserRouter>
Products.jsx
import React from 'react'
import { useParams } from 'react-router-dom'
function Products(props) {
const {id} = useParams();
console.log(props);
return (
<div>
<p>This product : {props.name} is in stock</p>
<p>The id from the params is : {id}</p>
<p>ye is : {props.ye}</p>
</div>
)
}
export default Products
Here is the screenshot of the console which show that only ssd is passed
