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

187
Vistas
Framer Motion Animate Presence without conditional rendering

I have the following React fly out navigation component using framer motion. This component is used multiple times for each navigation item.

Is there any other way to trigger this animation without conditional rendering (SEO)? Using key won't work, since I need it to be hidden by default and only visible when isActive equals true.

<AnimatePresence initial={false}>
    {isActive && (
        <FlyOutWrapper exit={{ opacity: 0 }} transition={{ duration: 0.2 }}>
            <FlyOutContent
                initial={{
                    x: "5rem",
                    opacity: 0,
                }}
                animate={{
                    x: 0,
                    opacity: 1,
                }}
                transition={{ duration: 0.3 }}>
                <Content>{title}</Content>
            </FlyOutContent>
            <FlyOutBackground
                initial={{ y: "-100%" }}
                animate={{ y: 0 }}
                transition={{ duration: 0.3 }}
            />
        </FlyOutWrapper>
    )}
</AnimatePresence>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

If you don't want it to leave the DOM then you don't need to use AnimatePresence at all. Instead, you can animate the position (and opacity, etc) based on your isActive state. You can do this with variants or just by switching between the properties directly.

Example (without variants):

<FlyOutBackground
    initial={{ y: "-100%" }}
    animate={{ y: isActive ? 0 : "-100%" }}
    transition={{ duration: 0.3 }}
/>

Example using variants:

const bgVariants = {
    visible: {
        y: 0
    },
    hidden: {
        y: "-100%"
    }
}
<FlyOutBackground
    variants={bgVariants}
    initial="hidden"
    animate={isActive ? "visible" : "hidden"}
    transition={{ duration: 0.3 }}
/>
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