createTransitionPresence
Keep elements mounted in the DOM until exit transitions or CSS animations finish.
createTransitionPresence coordinates enter and exit animations for conditionally rendered UI. It ensures that an element remains mounted in the DOM until its CSS exit animations or transitions complete.
Import#
Signature#
Usage Example#
src/AnimatedDialog.tsx
Details#
- Automatic Listener: Detects
animationendandtransitionendevents automatically on the registered element. - Fallbacks: Handles cancelled transitions, zero-duration animations, and instant updates safely without getting stuck in mounted state.