<Watch /> Component
#11323
Replies: 3 comments 2 replies
-
Any updates please? |
Beta Was this translation helpful? Give feedback.
0 replies
-
My exact thought! <form.Subscribe
selector={(state) => [state.canSubmit, state.isSubmitting]}
children={([canSubmit, isSubmitting]) => (
<button type="submit" disabled={!canSubmit}>
{isSubmitting ? '...' : 'Submit'}
</button>
)}
/> |
Beta Was this translation helpful? Give feedback.
0 replies
-
@cbetori, do you have an updated component version? Thanks |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I work with a lot of dynamic forms that need to render specific fields based on other the value of other form fields. I end up using
useWatch
pretty often and breaking up my form into smaller pieces to reduce the amount of fields that re-render. But from a composability perspective this has been a bit of a pain.It seems like
useWatch
could have its own component (similar to useController) that could alleviate this problem. The Watch component would subscribe to field changes and then render a given component. This way you can move theuseWatch
to lowest component level and prevent larger components from re-rendering. Here is my initial implementation:Example:
Beta Was this translation helpful? Give feedback.
All reactions