Skip to content
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

Create <Field as> and deprecate <Field component> and <Field render> #1406

Merged
merged 4 commits into from
Apr 2, 2019

Conversation

jaredpalmer
Copy link
Owner

@jaredpalmer jaredpalmer commented Apr 1, 2019

  • Deprecate <Field component> and <Field render>. These haven't been removed. However, they will yield a warning in the console.
  • Add <Field as> prop which just passes related handlers and props straight through. This should make Styled Components folks happy.

Related to #1371
Closes #1407
Closes #1408

@jaredpalmer jaredpalmer changed the title Create <Field as> and deprecate <Field component> Create <Field as> and deprecate <Field component> and <Field render> Apr 2, 2019
@jaredpalmer jaredpalmer mentioned this pull request Apr 2, 2019
@jaredpalmer jaredpalmer merged commit 97fb40c into hooks Apr 2, 2019
@jaredpalmer jaredpalmer deleted the feature/deprecate-field-component branch April 2, 2019 13:53
@jaredpalmer jaredpalmer mentioned this pull request Apr 2, 2019
24 tasks
);

warning(
component && children && isFunction(children),
'You should not use <Field component> and <Field children> as a function in the same <Field> component; <Field component> will be ignored.'
!!is && !!children && isFunction(children),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since line 94 defaulted https://github.com/jaredpalmer/formik/pull/1406/files#diff-bc78961df770c0df68f6cd758a6f2afdR94 as to input, wouldn't this error message show up every time the dev does this?

<Field name="name">
{({form, field}) => {
    return <MyCustomInput {...field} />
}}
</Field>

In the example above, as would default to input. In this case, would the check be something like as !== 'input'?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jaredpalmer Why we Field render will be deprecated.
Recently, we started using Field render in project. Formik 1.5.8
Please update API examples, if formik going to change ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants