admin管理员组文章数量:1317909
Recently I started a project in React, using NextJS. I've learned that in this tool, each file in 'pages' folder is a route in the site. But it makes me wonder... is there any way to configure this, so I can have multiple files inside 'pages' folder without showing them when I deploy the app? If so, how can I do it?
Thanks in advance
Recently I started a project in React, using NextJS. I've learned that in this tool, each file in 'pages' folder is a route in the site. But it makes me wonder... is there any way to configure this, so I can have multiple files inside 'pages' folder without showing them when I deploy the app? If so, how can I do it?
Thanks in advance
Share Improve this question asked Sep 15, 2022 at 17:20 Andrés F Ariza CalderónAndrés F Ariza Calderón 2353 gold badges9 silver badges19 bronze badges 2- did you mean dynamic routes ? nextjs/docs/routing/dynamic-routes – norbekoff Commented Sep 15, 2022 at 17:24
- in general, it can be dinamic or static routes – Andrés F Ariza Calderón Commented Sep 15, 2022 at 21:19
2 Answers
Reset to default 7You should not keep non routes/pages related files inside pages folder. All non explicitly pages related files should be formed as ponents or other services and placed to relevant folder like ponents/MyComponent/... or services/... and etc.
If you need temporarily hide some page you can add "#" prefix to the name like #myPage.tsx - it will make it unavailable.
In the way you want to hide it it is impossible If you want to create protected routes for some users or for authenticated well this is different thing
dynamic routes could be the solution but the file/s will be still visible
本文标签: javascriptNextjs how can I hide a route in a projectStack Overflow
版权声明:本文标题:javascript - Nextjs how can I hide a route in a project - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742026642a2415665.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论