so i need to reset the input value after changing the country but it keeps the same value , i'am using react functional components , and i'am stuck at this point
this is my code below
<PhoneInput
country={ip.toLocaleLowerCase()}
value={phone}
countryCodeEditable={false}
specialLabel={""}
enableSearch={true}
masks={phoneFormat}
searchPlaceholder={""}
placeholder={t("register:phone")}
inputStyle={{
paddingTop: 26,
paddingRight: 14,
paddingBottom: 26,
paddingLeft: 58,
width: "100%",
zIndex: 1,
backgroundColor: "#F3F6F9",
border: "none",
}}
onChange={(e) => {
setPhone(e);
setErrors({ ...errors, phone: false });
}}
Thanks for answering
Is ip stored in state somewhere? You might have a const [ip, setip] = useState() somewhere, and you then set ip in the change handler above to:
onChange={(e) => {
setPhone(e);
setErrors({ ...errors, phone: false });
setIp(e.target.value)
}}