Started using react router v6.3 today, and i implemented it on the index.js, and everything works fine when the link is http://localhost:3000/, but when i click the link to go to the cart component, it returns an error because the cart props is located in the App.js not index.js, Is there a way to use the props from App.js in index.js?
index.js
import Cart from ./src/Cart
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<Router>
<Routes>
<Route path ="/" element ={<App/} />
<Route path ="cart" element ={<Cart cart ={cart}/} />
</Routes>
</Router>
);