i would like to disable the continue button if values is empty, but with this if we enter space it is validating and enabling the button. i am also trimming the value.
const disableContinue = () => {
if (!watch('firstName') || !watch('lastName')) return true;
if (!watch('nameChangeReason')) return true;
if (watch('nameChangeReason') === 'Other') {
if (!watch('nameChangeOtherReason')) return true;
}
return false;
};
textField component
<TextField variant="outlined" inputRef={typeof register === 'function' ? register(name) : ref} required={required} value={typeof value === 'string' ? value?.trimStart() : value} name={name} />