Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

204
Views
React js - how to reset react-phone-input-2 input after changing country code

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

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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)
         }}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!