Home > other >  Module '@hookform/resolvers' has no exported member 'yupResolver'
Module '@hookform/resolvers' has no exported member 'yupResolver'

Time:09-11

I have the following import in my component, but it's causing an error.

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";

CodePudding user response:

you are not setting the poth correctly to yupResolver

change :

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

to :

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