-
Notifications
You must be signed in to change notification settings - Fork 1.1k
V6 #252
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
V6 #252
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/bluebill1049/react-hook-form-website/p4vz2qllw |
I've found 'clearError' missed in the example code and i inserted it.
"gatsby": "2.21.21", | ||
"gatsby-image": "2.4.3", | ||
"gatsby-plugin-google-analytics": "2.3.1", | ||
"@hookform/devtools": "2.0.0-beta.1", |
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.
Is there any reason hookform/devtools is not in devDependencies. (Also we should bump to 1.2.1). Will create PR in the near future.
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.
its a specail build, because normally devtool export null in prod.
Korean translation for V6 is done. |
Thank you very much @adhrinae <3 |
* Implement "Types" * Remove unused lodash * Make Clear Errors More Readable * Add TS and types example to setValue * Show TS codeSandbox for Types rawCode
* Implement "Types" * Remove unused lodash * enhance getValues docs
@@ -1,5 +1,5 @@ | |||
export const step1 = `module.exports = { | |||
setupFiles: ["<rootDir>/setup.ts"] | |||
setupFilesAfterEnv: ["<rootDir>/setup.ts"] |
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.
@bluebill1049 I fixed code example.
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.
Thanks @keiya01 today is the day ❤️
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.
I’m so nervous🥳
📖 Documentation
🚨 Breaking changes
validationSchema
and embrace validation resolverhttps://github.com/react-hook-form/react-hook-form-resolvers
Reason: we would love to support all kinds of schema validation instead of just Yup, also it's not fair to carry that extra logic for users who don't use schema at all. also perhaps there are lighter options than only
Yup
as well.validationResolver
to resolvervalidationContext
to contextvalidateCriteriaMode
tocriteriaMode
Reason: less for the user to type, consistent with the rest of the APIs. This is a generic validation library, it makes sense to keep naming generic and validation should already be the context for this whole lib.
Controller
propsonChange
change from array arguments to object argumentsReason: This should be the expected behavior for function's
arguments
.triggerValidation
rename totrigger
Reason: Less for a user to type and consistent with the rest of the APIs. However, if this having issue or conflict with your existing code base, you have the option to rename it in the deconstructor.
FormContext
rename toFormProvider
Reason: Align name with all those big libraries such as Redux, styled-components and etc.
FormContext
Reason: Some users may want to use
FormContext.Consumer
.nest
option forwatch
&getValues
, so data return from both methods will be inFormValues
shape.Reason: Consistency for form values and better type support.
🥃 New Features
NestedValue
Reason: The field value can be array/object such as Material-UI Multiple Select and custom registered field (Custom Register).
Currently, errors object expects an array value to always be multiple fields, but it can also be a single field with an array value. To solve this, it supports NestedValue to determine if it is the field value (array/object).
useWatch
(new) subscribe to registered inputs.Reason: This could isolate the re-render within a particular component without trigger re-render at the form level. This is different from
watch
API, which will re-render at the root ofuseForm
getValues()
support array of field namesReason: API Consistency with
watch
useForm({ mode: 'all' })
support all validationReason: so each input can validate with blur and change. react-hook-form/react-hook-form#1222