raj kumar
raj kumar

Reputation: 11

Why Next Js Default router is Not working?

default router is not working even though when i use correct folder structure in version 13.5.4 next Js.

Simply i created the new project using the command like npx create-next-app@latest project name and inside the App folder created the folder called user.Inside the user folder created the about.js file.but it shows the 404 page when i use the url (http://localhost:3000/user) I don't know why?.

Folder structure

404 error page

Upvotes: 1

Views: 489

Answers (1)

Chris
Chris

Reputation: 58142

When using the "app folder" for Next, your pages need to be actually called "page.js" (or "page.jsx" or "page.tsx")

So if you wanted to access the user page at localhost:3000/user, your directory structure should be:

app/
  user/
    page.js

Reference: https://nextjs.org/docs/app/api-reference/functions/use-search-params

Upvotes: 1

Related Questions