React Project --Help

Hey there !! I’ve a question about react router. I have data for some vehicles, in the dashboard of my app I have displayed the data using a grid of material cards now I want to create a route such that whenever I click on that particular vehicle It will open a component showing the full data about that vehicle. How can I do that ?

You want to use route props. Dynamically generate <Link> elements for each vehicle and set the path to include the vehicle’s id.

<Link path={"/vehicle/" +}>
    <OtherStuff />

Then you can have a component access the id prop after you set it up in a route.

const Vehicle({ match }) => (
1 Like

Thanks bro!!

I tried something similar. It worked.