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
:)我們還可以用另一種方式了。 –