AnimatePresence and Exit Not Working for Components - framer-motion

Viewed 196

I've got this code in index page.

const screen = "landing";
<AnimatePresence exitBeforeEnter>
  <Header key="header" />

  {screen === "landing" && <LandingComponent key="landing" /> // in here this work for me.
</AnimatePresence>

and here is Header component

 return ...map(
(item) =>
  item === ... && (
    <motion.img
      src="https://assets.glitch.ge/abba/setlist/logo.png"
      className={style.image}
      initial={{ opacity: 0 }}
      animate={{ opacity: 1 }}
      transition={{ duration: 0.5, delay: 0.3 }}
      exit={{ opacity: 0 }}
    />
  )
);

in here not work exit animations

0 Answers
Related