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

116
Vistas
react does not memorize state

I have the following problem, i set the opacity of an element depending on the useState, but if i go another route, the opacity sets back to 0

const [phoneVisible, setPhoneVisible] = useState(false);

useLayoutEffect(() => {
  if (toggleEvent !== "undefined") {
    setTimeout(() => {
      animatePhone(phoneRef, toggleEvent);
      setPhoneVisible(toggleEvent);
    }, 100);
  }
}, [phoneRef, toggleEvent]);

return (
<>
      <div
        ref={phoneRef}
        style={{ opacity: phoneVisible ? 1 : 0 }}
        className="relative w-screen h-screen"
      >
      ...
      </div>

</>
);

Im out of ideas, thanks for your help

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