NextJS URL 参数,如 React-Router [英] NextJS URL params like React-Router
问题描述
我是 NextJS 的新手,第一印象非常好.但是在给它一个机会之后,我遇到了一些问题,比如带有自定义参数的 URL 路由,比如 react-router.
I'm a newbie to NextJS, It looks so good on the first impression. But after giving it a chance I've faced some problems like URL routing with custom params like react-router.
https://url.com/users?id:123
为了更好的 URL 模式,我们需要什么
https://url.com/users/123
在 react-router 这里有完美的例子 https://reacttraining.com/react-router/web/example/url-params
In react-router It has perfect example here https://reacttraining.com/react-router/web/example/url-params
推荐答案
此示例将帮助您定义参数化的命名路由.它使用 nest/routes 并让您定义您的自定义偏好路线.希望能帮到你.
this example will help you define your parameterized, named routes. it uses nest/routes and let you define your custom routes of preference. hope it will help you.
https://github.com/zeit/next.js/tree/master/examples/with-next-routes
这篇关于NextJS URL 参数,如 React-Router的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!