← React.js learning path
React.js · Module 9 of 10

Routing and data fetching

Build multi-page apps with React Router and load data from APIs.

📖 Key ideas

  1. React Router maps URLs to components: <Route path="/about" element={<About />} />.
  2. Link navigates without reloading: <Link to="/about">.
  3. useParams reads URL parameters like /users/:id.
  4. Fetch data with fetch or libraries like TanStack Query (caching, retries).
  5. Show loading and error states for every request.
💡 Real-life example: A router is a receptionist: tell it the room number (URL) and it walks you to the right room (component).
RouteMaps a path to a component
LinkNavigates without a page reload
useParamsReads URL parameters
TanStack QueryLibrary for fetching and caching data