Invoking a route in Link but as a component & with an argument obj to pass to the component
The Github:https://github.com/nnall/hm-frontend-Nick.git
I have a component, <VehicleDetails/> which is meant to take in a 'vehicle' object argument, in order to render details on a car details page.
<VehicleDetails/> is listed as a Route in App.js, with path "/vehicle-details"
Another Route - my <Store/> component - has, in its return, a Carousel component which maps some <Store/>-fetched inventory, vehicle objects, into carousel 'cells'. This Carousel is supposed to be in the return of <Store/> like this:
And this is how the Carousel uses the storeInventory for that location to render html:
In each cell/vehicle that the Carousel returns, I want to include a
<Link/>
for that vehicle, which will both take the user to the <VehicleDetails/>
component, but I also want to invoke iVehicleDetails by also pass that current 'vehicle' object being mapping over into <VehicleDetails/> as the user is taken to that component, so that another api call doesn't have to be made for that same 'vehicle' object again once the user gets to VehicleDetails.
I am working on getting my example repo caught up to post here too, but in the meantime the picture attached shows everything I'm talking about and how the components are relating.
Any input it greatly appreciated as always.GitHub
GitHub - nnall/hm-frontend-Nick
Contribute to nnall/hm-frontend-Nick development by creating an account on GitHub.
0 Replies