Alll the errors are removed if I change a single value, how to prevent it.
const courseForm = useForm({
initialValues: {
isSaveClickedAtleastOnce: false,
loading: -1,
step: 1,
cta: 'Buy Now',
},
validateInputOnChange: true,
validate: values => ({
title: !values?.title
? 'Title is required'
: values.title?.length > 100
? 'Title should be less than 100 characters'
: null,
price: !values?.price
? 'Price is required'
: values.price < 1
? 'Price should be greater than 0'
: null,
discountedPrice: !values?.discountedPrice
? 'Discounted Price is required'
: values.discountedPrice >= values.price
? 'Discounted Price should be less than price'
: values.discountedPrice < 0
? 'Discounted Price should be greater than 0'
: null,
});