When you create a new app using

TG Data Set: A collection for training AI models.
Post Reply
aminaas1576
Posts: 548
Joined: Mon Dec 23, 2024 3:34 am

When you create a new app using

Post by aminaas1576 »

The main thing about working with theframework

The main thing about working with theframework
87% of our graduates are already working in IT
Leave a request and we will help you choose a new profession
Leave a request
Pages and routes
In Next.js, you don't need to use a library to manage routes. the create-next-app command, by default a folder is created with the name of the page through which routing occurs. This way, each react component file in the folder is treated as a specific path:

Index page localhost/index
About the localhost/about page
Blog page localhost/blog
If a user hits a non-existent route, such as "localhost/home",will automatically show a 404 page.

Here's an example of about.js with a regular laos email list React functional component.

The main thing about working with theframework

Nested routes
To create nested routes such as localhost/blog/contact, you need to create a subfolder and inside it a react component called contact.js. If you create an index.js file in the latter,will use it to represent the root route. Example: localhost/blog will render pages/blog/index.js

In this framework, you can create a dynamic route using brackets, where each blog post has its own path. For example: pages/blog/[slug].js

Links to routes
Now that you have created your first route, you can link pages to it using 'next/link'.
Post Reply