I need to change the phone format from +XX XXX XXX XXXX into +XXXXXXXXXXXXX. I have a code but everytime I change it it doesn't work locally.
const [phoneNumber, setPhoneNumber] = useState();
const validatePhone = phone => {
if (!isValidPhoneNumber(phone)) {
errors.phone = { type: 'required', message: 'not valid' };
return;
}
delete errors.phone;
clearErrors('phone');
};
return (
<>
<PhoneInput
international
displayInitialValueAsLocalNumber
defaultCountry="UA"
className={classes.phone_input}
value={phoneNumber}
onChange={handlePhoneInputChange}
name="phone"
id="phone"
/>
)
question from:https://stackoverflow.com/questions/65939073/phone-format-in-react