Closed onlyreddy closed 1 year ago
Hi @onlyreddy
In your case onChange
is called because you passed an empty string to the value
prop.
You can change the initial value for phoneNumber
to "+1 "
:
// before:
const [phoneNumber, setPhoneNumber] = React.useState<string>("");
// after:
const [phoneNumber, setPhoneNumber] = React.useState<string>("+1 ");
It's worked for me.
Hi,
I'm using the Phone component in my project and observed one issue related to it.
The
onChange
is called at the time of component loading. Ideally, it should call if there is a change in the country or phone value.Created a Code sandbox demo to reproduce the fix.
Can you please help me to fix it?