【发布时间】:2021-03-21 08:22:42
【问题描述】:
我想知道是否可以在 Next.js 中呈现页面之前重定向用户?
现在我有这个:
import { useRouter } from 'next/router';
export default function RedirectPage() {
const router = useRouter();
router.push('/projects');
return (
<div><h1>hi</h1></div>
)
}
出现此错误:Error: No router instance found. you should only use "next/router" inside the client side of your app.
谢谢。
【问题讨论】:
标签: javascript node.js next.js