I have installed yup and tried to validate my form with this, however when I try to import it to a file I get this error. I do not even run the handler, it just errors me out on page load. I use it with react.
this is my code
import * as yup from "yup";
export const detailsSchema = yup.object().shape({
cheeseType: yup()
.string()
.isRequired()
});
I tried to rm -rf node_modules, I did not help.
Thanks for helping me out.
It solved this error I used wrong method - isRequired() instead of required() and also here I was wrong:
cheeseType: yup()
.string()
.isRequired()
should be
cheeseType: yup
.string()
.isRequired()
so the correct schema looks like
cheeseType: yup
.string()
.required()
All the best! :)