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

169
Vistas
How to use callback of setState in some places not all via hooks

I want to set a state and sometimes I want to do something after that and sometimes not!

how can I do that with hooks?

sometimes I want to call a function or do something after setting that:

 this.setState({inputValue:'someValue'},()=>{
    //do something
    })

but sometimes not

this.setState({inputValue:'someAnotherValue'})

then I couldn't use of useEffect like this because I don't want to do something after setting that all the time:

useEffect(()=>{

    //do something 

},[inputValue])
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

useEffect(() => {
    if(inputValue == someValue){
        //do something
    }
}, [inputValue])
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