-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/task 7 formik #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature/task-6
Are you sure you want to change the base?
Conversation
Vladyslav-Velytskyi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| const MovieSchema = Yup.object().shape({ | ||
| title: Yup.string().required(), | ||
| url: Yup.string().required(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be logically if it has url validation, because random string couldn't be a url. Yup has api for it
| url: Yup.string().required(), | |
| url: Yup.string().url().required(), |
| title: Yup.string().required(), | ||
| url: Yup.string().required(), | ||
| releaseDate: Yup.string().required(), | ||
| rating: Yup.number() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For number you can use min() and max()
| rating: Yup.number() | |
| rating: Yup.number(),min(0).max(10) |
| return val >= 0 | ||
| }), | ||
| overview: Yup.string().required() | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also you can check data types in the backend side, they use Joi library, it's almost the same to Yup
| value={formik.values.title} | ||
| onBlur={formik.handleBlur('title')} | ||
| /> | ||
| {formik.touched.title && formik.errors.title} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create a simple component which will render error according to mockup


No description provided.