相关疑难解决方法(0)

nextjs:如何从Next.js中的url获取GET(查询字符串)参数?

当我点击index.js中的链接时,它会将我带到about.js页面.当我通过url从index.js传递参数名称到about.js,我不知道如何在about.js页面中获取它.

我在index.js中的代码:

import Link from 'next/link'
export default () => (    
<div>Click <Link href={{ pathname: 'about', query: { name: 'leangchhean' }}}><a>here</a></Link> to read more</div>
)
Run Code Online (Sandbox Code Playgroud)

url:http:// localhost:3000/about?name = leangchhean

next.js

20
推荐指数
11
解决办法
3万
查看次数

标签 统计

next.js ×1