Get selected country Code, like 'uk'
rijans opened this issue · comments
Jaber Al Nahian commented
Any way to get selected country code? like 'uk' on select country?
Muhammadbek commented
Hi, You can destructure dialCode from data
interface IMaskedInput {
dialCode: string;
value: string;
}
const handlePhoneInputChange = (value: string, data: IMaskedInput) => {
console.log(data.dialCode); // +998
};
<PhoneInput
country={'uz'}
autoFormat
enableSearch
countryCodeEditable={false}
onChange={handlePhoneInputChange}
inputProps={{
name: PHONENUMBER,
}}
/>