← React Intermediate Questions - Set 7 Q62
How can you handle dynamic routing in React?
React Intermediate Questions - Set 7
Example
1
2
<Route path="/:section/:id" element={<Page />} />
const { section, id } = useParams();
What to notice
- Route params make one component serve any record under any section.
← Back to the question list