reactjs 模块“@hookform/resolvers”没有导出的成员“yupResolver”

oknrviil  于 2023-01-25  发布在  React
关注(0)|答案(1)|浏览(155)

我的组件中有以下导入,但它导致了错误。
import { yupResolver } from "@hookform/resolvers";

ERROR in ./src/components/pages/Forms.tsx 26:14-25
export 'yupResolver' (imported as 'yupResolver') was not found in '@hookform/resolvers' (possible exports: toNestError, validateFieldsNatively)
>
>webpack compiled with 1 error and 1 warning
ERROR in src/components/pages/Forms.tsx:2:10
TS2305: Module '"@hookform/resolvers"' has no exported member 'yupResolver'.

    1 | import { useForm } from "react-hook-form";
  > 2 | import { yupResolver } from "@hookform/resolvers";
      |          ^^^^^^^^^^^
    3 | import * as yup from "yup";
bxpogfeg

bxpogfeg1#

你没有正确设置poth到**yupResolver**

变更:

import { yupResolver } from "@hookform/resolvers";

收件人:

import { yupResolver } from '@hookform/resolvers/yup';

相关问题