-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Learn React with TypeScript - Third Edition
By :
Next.js gives us a comprehensive set of features to create multi-page apps. Different routes are defined using folders and a special page.tsx file. Dynamic routes are defined using square brackets containing the route parameter. We created a static route for a blog post list and a dynamic route for each blog post.
A shared layout component is defined in layout.tsx in the relevant folder. We used the root layout to share a Header component.
The Link component is the recommended way of navigating in Next.js and can be used in RSCs as well as Client Components. We used this in the blog post list as well as the app header. The useRouter hook allows programmatic navigation in Client Components.
Route and search parameters can be accessed via params and searchParams props, respectively. They can also be accessed in Client Components via useParams and useSearchParams hooks. We used an id route parameter in the blog post dynamic route. We also used a criteria search parameter...