Book logo

Contacts

Book

Review of NextJS router
  1. Understand how routes are setup from /app/pages.js
  2. Created custom 404 page with app/not-found.jsx and setup nav/aside in app/layout.js
  3. Nested routes are created as folders/subfolders within the app directory.
  4. Navigation between pages is implemented using the Link component.
  5. Dynamic routes are created as subfolders with square brackets e.g.contacts/[id]
  6. Dynamic parameters can be extracted using useParams() hook for client components orconst param = await params; and const id = param.id; for server components.
  7. Learnt the hard way that server components can't pull data from client localForage cache.