Framer Motion is an open source, production-ready library that’s designed for all creative developers.
It looks like this:
<motion.div animate={{ x: 0 }} />
It does all this:
...and a whole lot more.
Install framer-motion
with via your package manager:
npm install framer-motion
Then import the motion
component:
import { motion } from "framer-motion"
export const MyComponent = ({ isVisible }) => (
<motion.div animate={{ opacity: isVisible ? 1 : 0 }} />
)