Skip to content

Get unformated value in onChange

I have a form with validation. For simplicity, lets say I have a phone number (react-phone-number-input) and other field. And when phone number is entered, other field becomes required. The problem is that when I type, for example, 1, onChange handler returns undefined since it cannot format input yet. Althought, for user there is a value inputed (+11), but I cannot see this in code since it is undefined. Is there a posibility to maybe add second optional parameter for onChange with raw, unformated value? In described scenario onChange would look like this: onChange(undefined, '11').