Concept
A router maps URLs to components, so each screen has an address the user can bookmark and share. Links change the URL without reloading the page, and the router renders the matching route.
The tutor works through these with you, in conversation and code. A session ends when you have shown them, not when a video does.
A few lines that show Routes and links doing its job.
import { createBrowserRouter, RouterProvider, Link } from "react-router-dom";
const router = createBrowserRouter([
{ path: "/", element: <Home /> },
{ path: "/orders", element: <Orders /> },
]);
function Nav() {
return <nav><Link to="/">Home</Link> <Link to="/orders">Orders</Link></nav>;
}
<RouterProvider router={router} />Using an <a href> for in-app navigation. The browser performs a full page load, throwing away state and refetching everything. Use the router's Link.
Your roadmap puts these before Routes and links, unless you already know them.
Once a session shows you understand Routes and links, it comes back for review. Each review takes a minute and tells the memory model how well you still know it.
Topics that build on Routes and links.