I’m trying to create a different layout for each route groups, there’s 3 layouts: auth, dashboard, and public. But when I group the routes, the error "Non matching path () provided for /(public)" occured. Here’s my folder structure:
Is there something wrong with the structure? Or is there something i missed?
2
Answers
Check out this docs – https://nextjs.org/docs/app/building-your-application/routing/colocation
In case your (public) group does not have any sub pages. Move the children out of the (public) folder, else move page.tsx inside a folder representing the route.
As far as my understanding and according to the documents, the folder
(public )
is only for grouping and won’t be consider a path, in order to make the route accessible you need to put thepage.js
inside another folder eg:(public)/public/page.js
This will make it accessible by/public
route.