on-internet
← Community

How to improve form provider performance in React Hook Form

Stack Overflow ·

Since the react hook form provider is based on context Api, for large nested forms it can cause performance issues due to multiple re-renders during state updates. I came across this section in the documentation: https://react-hook-form.com/advanced-usage#FormProviderPerformance, which basically uses react memo to stop additional re-renders unless the property isDirty changes. I added the above implementation to my code and it has helped speed up the form performance a little but I now realize that my validations are not working since my memo does not check for updates to the formState. https:

Comments

Sign in or sign up to comment and upvote.

No comments yet.