← React.js learning pathReact.js · Module 9 of 10
Routing and data fetching
Build multi-page apps with React Router and load data from APIs.
📖 Key ideas
- React Router maps URLs to components: <Route path="/about" element={<About />} />.
- Link navigates without reloading: <Link to="/about">.
- useParams reads URL parameters like /users/:id.
- Fetch data with fetch or libraries like TanStack Query (caching, retries).
- 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