Optional customOptional exitReplace with mode="wait"
Replace with mode="wait"
Optional initialBy passing initial={false}, AnimatePresence will disable any initial animations on children
that are present when the component is first rendered.
<AnimatePresence initial={false}>
{isVisible && (
<motion.div
key="modal"
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
/>
)}
</AnimatePresence>
Optional modeDetermines how to handle entering and exiting elements.
"sync": Default. Elements animate in and out as soon as they're added/removed."popLayout": Exiting elements are "popped" from the page layout, allowing sibling
elements to immediately occupy their new layouts."wait": Only renders one component at a time. Wait for the exiting component to animate out
before animating the next component in.Optional onFires when all exiting nodes have completed animating out.
Fires when all exiting nodes have completed animating out.
Optional presenceInternal. Used in Framer to flag that sibling children shouldn't re-render as a result of a child being removed.
Generated using TypeDoc
When a component is removed, there's no longer a chance to update its props. So if a component's
exitprop is defined as a dynamic variant and you want to pass a newcustomprop, you can do so viaAnimatePresence. This will ensure all leaving components animate using the latest data.