Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

202
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda