Reputation: 121
React hook form - the main application has form with child components is having multiple re-renders when a value is changed in the child component. the value change will not re-render the application if we use "Controller" directly in the main application. How can we change it to update only child component not the parent every time we change the value in the child component
Also reset doesn't seems to work.
code sample in the below link:
https://stackblitz.com/edit/ionic-react-hook-form-sxsax7?file=src%2FApp.tsx
Thank you for the help in advance...
Upvotes: 2
Views: 3958
Reputation: 33345
i thin you are spending too much time worrying about rendering at this point in your application... BUT if you wrap the components in React.memo it will reduce the rerenders.
export default React.memo(Footer);
You can google rerender optimization and find multiple articles discussing it and when to really worry about it and when not to
Upvotes: 1