I am trying to access Form.useWatch() from antd in checkAccountNumber function but I am getting this error
Hooks can only be called inside of the body of a function component.
const getFieldValue = (fieldName,form) => {
return Form.useWatch(fieldName,form);
}
const checkAccountNumber = () => {
const accountNumber = getFieldValue("account_number", form)
if(isNumeric(accountNumber))
console.log("this true")
else
console.log("this is false");
}
Hooks Can't be call inside function. Only in Component.
If you want to use that write a custom hook.