const App = () => { return( <Router> <Routes> <Route path="/component1" element={<Component1 />} /> <Route path="/component2/:data" element={<Component2 />} /> </Routes> </Router> ) } const Component2 = () => { const { data } = useParams(); return( <div> <h2>The data is: {data}</h2> </div> ) }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter