-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
I want to take folk's temperature on some warts that I want to change related to <Field> as well as discuss how best to move forward in a way that doesn't force people to rewrite stuff immediately.
<Field component>
This prop is the source of a ton of confusion because it does not simply pass through onChange, onBlur, and value but rather field and form. This means that there is some inconsistent behavior with respect to <Field component="select"> vs. <Field component={MyInput}>. I think a decent solution is to create a new prop called is or as and make that prop just pass through onBlur, onChange, value/checked as expected. We then would put a deprecation warning on component instructing people to use as/is or children and eventually remove component entirely in future versions. Unfortunately, this will force folks to change every single "select" and "textarea" over time, but this at least avoids breaking changes
<Field render>
This is just redundant at this point. We should put up a deprecation warning suggesting to use children as a function.
<Field children>
We should merge #343 and add a meta to <Field children>.
<Field>
- {({field, form }) => ... }
+ {({field, form, meta }) => ... }
</Field>Next Steps
In a perfect world, we make these changes gradually in a way that prevents people from having to rewrite stuff. I definitely don't want to have to rewrite all my inputs, but we need to make these changes at some point. We also need to consider that <Field> will have a dramatically reduced usage in the future once the useField hook is released.
Umbrella Issues
- Field
meta(Add meta prop to Field, FastField #343) - Deprecate
renderandcomponent(Create <Field as> and deprecate <Field component> and <Field render> #1406)