You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
see in console that value from info parameter is always undefined
value field return in info param from the watch callback is always undefined (even though the values field [first argument] is updated with the actual value)
constmethods=useForm({// mode: "onBlur",// reValidateMode: "onBlur",defaultValues: {name: "name"}});const{ watch }=methods;useEffect(()=>{// value is allways undefined hereconstsub=watch((data,{ name, type, value })=>{console.log("field: ",name," type: ",type," newValue: ",value);});return()=>sub.unsubscribe();},[watch]);
Expected behaviour
Value to get updated properly on every change.
What browsers are you seeing the problem on?
Chrome
Relevant log output
From codesandbox:
name field watched from outside: namesss
field: name type: change newValue: undefined
name field watched from outside: namessss
field: name type: change newValue: undefined
name field watched from outside: namesssss
field: name type: change newValue: undefined
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
@bluebill1049 Thx for quick response, so the actual value should be read from firs argument (data), yes ?
Also a informative question, there is a lot of possible values for the type property (it could be undefined, changed, ....)
Where I could inform myself under what circumstances is each of them used ?
Version Number
^7.39.7
Codesandbox/Expo snack
https://codesandbox.io/s/react-hook-form-watch1-forked-pwiuwg?file=/src/App.js
Steps to reproduce
value
frominfo
parameter is always undefinedvalue
field return ininfo
param from the watch callback is always undefined (even though the values field [first argument] is updated with the actual value)Expected behaviour
Value to get updated properly on every change.
What browsers are you seeing the problem on?
Chrome
Relevant log output
Code of Conduct
The text was updated successfully, but these errors were encountered: