vsmrtn
vsmrtn

Reputation: 35

How to switch content in Next.js

So I have a main dashboard on my app, in which I have a sidebar navigation and content container. But since I`m new to next.js and unfamiliar with its routing system, I don't know how to implement content changing when a user uses sidebar navigation. Should I make a separate page for each navigation route?

Upvotes: 0

Views: 1451

Answers (1)

Roman Mkrtchian
Roman Mkrtchian

Reputation: 3006

Yes, for each route your have to create a file in pages directory.

  • for route / you create the file pages/index.js
  • for route my-page you create the file pages/my-page.js
  • for route path/my-page you create the folder pages/path and the file pages/folder/my-file.js

For more explanation you can read the documentation of Next.js on routing. And you can also follow the official tutorial to get basic knowledge of Next.js.

Upvotes: 1

Related Questions