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

Drastically improve performance by implementing FormState getters #26

Merged
merged 5 commits into from Feb 10, 2023

Conversation

crutchcorn
Copy link
Member

This PR borrows a trick from React Hook Form to lazily initialize the values of the isTouched, isValid, isDirty for the form accumulator state to drastically improve performance.

Benchmarks went from 2x in Formik's favor to 1.25x in Formik's favor - with the exception of onChange detection being 1.13x in HouseForm's favor.

Closes #25

@crutchcorn
Copy link
Member Author

@all-contributors please add @crutchcorn for test

@allcontributors
Copy link
Contributor

@crutchcorn

I've put up a pull request to add @crutchcorn! 🎉

# Conflicts:
#	lib/form/form.tsx
@crutchcorn crutchcorn merged commit 6048571 into main Feb 10, 2023
@crutchcorn crutchcorn deleted the getters branch February 10, 2023 08:51
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.

Investigate getters for Form errors, dirty, touched, valid accumulative states.
1 participant