← Lesson
BitWithBite
React · Quick Reference

Lesson 12 — React Router Cheat Sheet

React
In one line: React Router reads the URL and renders the matching component — no full page reload.

Key Ideas

1BrowserRouter. Wraps the app.
2:slug. Dynamic segment, read via useParams().
3Link. No full reload navigation.
4path="*". Catch-all — always last.

Setup

<BrowserRouter> <Routes> <Route path="/" element={<Home/>} /> <Route path="/courses/:slug" element={<Detail/>} /> <Route path="*" element={<NotFound/>} /> </Routes> </BrowserRouter>