Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

198
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda