/ → <Home />
/about → <About />
/profile → <Profile />
// All inside <div id="root"></div>
[User clicks <Link> / useNavigate called]
↓
BrowserRouter listens
↓
Check <Routes> → match <Route path>
↓
Render matched component in <div id="root">
↓
React updates Virtual DOM → minimal real DOM changes
npm install react-router-dom
This gives you:
<BrowserRouter> → listens to URL changes, provides routing context<Routes> → wrapper for all <Route><Route> → maps URL → componentuseNavigate, useParams)