• When a component is the child of AnimatePresence, it can use usePresence to access information about whether it's still present in the React tree.

    import { usePresence } from "framer-motion"

    export const Component = () => {
    const [isPresent, safeToRemove] = usePresence()

    useEffect(() => {
    !isPresent && setTimeout(safeToRemove, 1000)
    }, [isPresent])

    return <div />
    }

    If isPresent is false, it means that a component has been removed the tree, but AnimatePresence won't really remove it until safeToRemove has been called.

    Returns AlwaysPresent | Present | NotPresent

Generated using TypeDoc