Workaround for dynamic namePath
for Form?
#45041
Answered
by
zombieJ
bombillazo
asked this question in
Q&A
-
Hello, we want to "watch" the value of a for.item that is configurable via props, including the path name. Is there any way to get around the limitation of needing a static path for useWatch with forms? Warning: `useWatch` is not support dynamic `namePath`. Please provide static instead. |
Beta Was this translation helpful? Give feedback.
Answered by
zombieJ
Sep 25, 2023
Replies: 1 comment 4 replies
-
You can do watch on the top level and wrap it: const useMyWatch = (namePath, form) => {
const root = useWatch('');
return get(root, namePath);
}; |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
bombillazo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can do watch on the top level and wrap it: