我正在使用yup验证进行react-form-hook 。所有依赖项都安装好并在 package.json 文件中更新,但验证不起作用。
所有这些yup验证都很好地在 codeandbox.io 中使用相同的代码。而且我添加了一个带有react-bootstrap的导航栏,但这也不起作用。
以下是安装的依赖项:
"dependencies": {
"@hookform/error-message": "0.0.4",
"@testing-library/jest-dom": "^5.11.5",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"react": "^17.0.1",
"react-bootstrap": "^1.4.0",
"react-dom": "^17.0.1",
"react-hook-form": "^6.10.1",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.0",
"rsuite": "^4.8.4",
"web-vitals": "^0.2.4",
"yup": "^0.29.3"
},
下面是导入部分
import React from "react";
import { useForm } from "react-hook-form";
import * as Yup from "yup";
我完全没有错误。