React - animate mount and unmount of a single component

前端 未结 16 1782
南笙
南笙 2020-12-22 16:34

Something this simple should be easily accomplished, yet I\'m pulling my hair out over how complicated it is.

All I want to do is animate the mounting & unmounti

16条回答
  •  长情又很酷
    2020-12-22 17:12

    Framer motion

    Install framer-motion from npm.

    import { motion, AnimatePresence } from "framer-motion"
    
    export const MyComponent = ({ isVisible }) => (
      
        {isVisible && (
          
        )}
      
    )
    

提交回复
热议问题