Closed peeke closed 4 years ago
Removing the useMemo
is what you want. If it was any other component it would look like this:
<Other ...
<Button ...
...
So it would be rendered the same amount of times. I think the performance impact is minimal (if it's even there).
My advise: take the simple route, remove the useMemo
and start the hard thoughts once you encounter a real problem.
I'm running into problems using the FormFieldValid component with the following setup:
In the code changes in formSubmitting are never picked up, because the render result is memoized based on the validity.
All fixes I could think of have some kind of drawback:
Seems unelegant. Might be difficult if the render component return a big portion of form which uses a lot of props.
I think this would make it impossible to render the whole form in one place, because the useCallback cannot be done inline.
@EECOLOR What do you think?