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

165
Visualizações
why the input value shows a type of string instead of type of number?

I am trying to get the input value type of number. But the value keep showing me its a type of string. How do i fix this?

const [price, setPrice] = useState();

const handlePrice = (event) => {
    console.log(event.target.value);
    setPrice(event.target.value);
};

        <div className="col-md-6">
          <label for="inputPrice" className="form-label">
            Price
          </label>
          <input
            value={price}
            onChange={handlePrice}
            type="number"
            className="form-control"
            id="inputPrice"
          />
        </div>
        <div className="col-12">
almost 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

const handlePrice = (event) => {
    console.log(event.target.value);
    // setPrice(parseInt(event.target.value));
    // setPrice(event.target.value * 1);
    setPrice(Number(event.target.value));
};
almost 4 years ago · Santiago Trujillo 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