๐Ÿ“Š We use cookies & analytics to improve your experience. Learn more
Latest

React & Modern Front-End Development Module 3 ยท Lesson 7 of 15

0% Exit to course

Module 3 ยท Shipping a portfolio app Lesson 7 of 15

Routing with react-router

Learning objective

Two screens and a shared layout are enough to justify a router. Routes map a URL to a component, and useParams reads the id out of the URL so a detail page can be linked to directly.

Worked example

A route /jobs/:id that reads id and renders the matching job is what makes a link shareable โ€” which is also what makes it worth putting on a resume.

Your practice task

Add a list page, a detail page and a not-found page, then paste a detail URL into a new tab and make sure it still works.

Do this before moving on. Reading a solution teaches the shape of it; typing it teaches you.

Key takeaway

Two screens and a shared layout are enough to justify a router. Routes map a URL to a component, and useParams reads the id out of the URL so a detail page can be linked to directly.

Create free account or sign in

Almost there

15 lessons left of 15

Finish every lesson to unlock the certificate. Each one ends in a practice task โ€” do them and the final project brief writes itself.

Next recommended course Full-Stack Web Development Bootcamp