2
当我点击index.js中的链接时,它会将我带到about.js页面。 当我通过从index.js到about.js的url传递参数名称时,我不知道如何在about.js页面中获取它。nextjs:如何从Next.js中的url获取GET(查询字符串)参数?
我的代码在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>
)
网址:http://localhost:3000/about?name=leangchhean
:)我们还可以用另一种方式了。 –