当我尝试使用 Router.push() 重定向时,出现以下错误:
TypeError: next_router__WEBPACK_IMPORTED_MODULE_3__.Router.push is not a function
Run Code Online (Sandbox Code Playgroud)
我正在尝试从 create-react-app 迁移到下一个 js。
const redirectUser = () => {
if (true) {
Router.push('/');
}
};
Run Code Online (Sandbox Code Playgroud)
Rya*_*gel 30
我不得不像这样导入:
// works
import Router from "next/router";
// dont
import { Router } from "next/router";
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5882 次 |
| 最近记录: |