Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在将 React 应用程序转换为 Next.js 女巫,我是新手。我面临获取分页页码的问题。在我this.props.match.params.page用来获取页码的反应应用程序中,有没有办法在 Next 中使用类似的东西?
this.props.match.params.page
谢谢你。
useRouter您可以使用钩子在客户端访问查询参数。
useRouter
import { useRouter } from 'next/router' export default () => { const router = useRouter() console.log(router.query) return <div></div> }
下一个路由器