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

182
Vistas
bundle.js:21632 Warning: Received NaN for the `value` attribute. If this is expected, cast the value to a string

I'm making a react app, I have 3 inputs(champ1, champ2, champ3) where I type values and I get the sum of them in another one, and that sum is used in a formula that's calculated in another input.

I get this error: "Warning: Received NaN for the value attribute. If this is expected, cast the value to a string." when I type and clear the inputs, it reads an empty value, what can I do to prevent that?

Here's my code:

const [input, setInput] = React.useState({
    champ2: 0,
    champ4: 0,
    champ6: 0,
});
const [sum, setSum] = React.useState(0)
const [eau, setEau]=React.useState(0)


useMemo(() => {
  
    setSum(parseInt(input.champ2) + parseInt(input.champ4) + parseInt(input.champ6))
  
}, [input])

useMemo(() =>{
  setEau(sum*0.02*4*8000)
},[sum])

//handle input change 



const handleInput=function(e){

    setInput({
      ...input, 
      [e.target.name]: e.target.value
  });
  
}
about 4 years ago · Juan Pablo Isaza
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