Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Replace all 'render' props to 'children' props in Formik elements #238

Merged
merged 2 commits into from
Feb 5, 2021

Conversation

ftianli-amzn
Copy link

@ftianli-amzn ftianli-amzn commented Jan 26, 2021

Issue #, if available:

With the Formik v2.x upgrade (#236), there is a new deprecation warning shows in the browser console (for screenshot see the PR above).

The solution is to replace all the usage of render props to children props in <Field>, <FastField>, <Formik>,<FieldArray> elements, according to the official guide: https://formik.org/docs/migrating-v2#deprecation-warnings

Description of changes:

  • Replace all 'render' props to 'children' props in Formik <Formik> <Field> <FieldArray> elements
  • Update jest snapshot files

Note:

  1. The children props can be used implicitly without stating children= (https://reactjs.org/docs/render-props.html#using-props-other-than-render)

  2. In Enzyme's mount() method, children props can't be put directly inside the element, so I state children= explicitly in the specific unit tests.
    image

Testing:

image

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ftianli-amzn ftianli-amzn changed the title Replace all the 'render' props to 'children' props in Formik elements Replace all 'render' props to 'children' props in Formik elements Jan 26, 2021
@ftianli-amzn ftianli-amzn marked this pull request as ready for review January 26, 2021 19:15
@ftianli-amzn ftianli-amzn added maintenance improves code quality, but not the product refactor labels Jan 26, 2021
@ftianli-amzn ftianli-amzn merged commit e4fab48 into opendistro-for-elasticsearch:master Feb 5, 2021
@ftianli-amzn ftianli-amzn deleted the formik2-warn branch February 5, 2021 01:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
maintenance improves code quality, but not the product refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants