Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

pass id to reactjs routes

<Route path="/products/:id">
  <Products />
</Route>

On the products page use useParams react hook to access the id Route match param.
import { useState } from "react"

const { id } = useParams();
 
PREVIOUS NEXT
Tagged: #pass #id #reactjs #routes
ADD COMMENT
Topic
Name
4+5 =