Nextjs Router.push vs href

问题描述 投票:0回答:1

对于单击路由到某个页面,我可以通过两种方式实现

import Router from 'next/router'  

<button onClick={() => Router.push('/about')}>
    <a>Go to About</a>
</button>

 <button>
     <a href="/about">Go to About</a>
 </button>

哪个是Nextjs的最佳实践?

javascript reactjs next.js
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.