Would Formik be slow on large form

File: https://github.com/jaredpalmer/formik/blob/main/packages/formik/src/Formik.tsx Reading Formik source code right now. And it seem like the way Formik writen is making the form always get re-render. Right? Code in question:
<FormikProvider value={formikbag}>
{component
? React.createElement(component as any, formikbag)
: render
? render(formikbag)
: children // children come last, always called
? isFunction(children)
? (children as (bag: FormikProps<Values>) => React.ReactNode)(
formikbag as FormikProps<Values>
)
: !isEmptyChildren(children)
? React.Children.only(children)
: null
: null}
</FormikProvider>
<FormikProvider value={formikbag}>
{component
? React.createElement(component as any, formikbag)
: render
? render(formikbag)
: children // children come last, always called
? isFunction(children)
? (children as (bag: FormikProps<Values>) => React.ReactNode)(
formikbag as FormikProps<Values>
)
: !isEmptyChildren(children)
? React.Children.only(children)
: null
: null}
</FormikProvider>
In addition, formikbag got recreate every render, so FormikProvider also got re-render. Or would there be someway for FormikProvider children to not be rerender everytime?
GitHub
formik/packages/formik/src/Formik.tsx at main · jaredpalmer/formik
Build forms in React, without the tears 😭 . Contribute to jaredpalmer/formik development by creating an account on GitHub.
No description
0 Replies
No replies yetBe the first to reply to this messageJoin