Used in conjunction with the m component to reduce bundle size.
m
m is a version of the motion component that only loads functionality critical for the initial render.
motion
LazyMotion can then be used to either synchronously or asynchronously load animation and gesture support.
LazyMotion
// Synchronous loadingimport { LazyMotion, m, domAnimation } from "framer-motion"function App() { return ( <LazyMotion features={domAnimation}> <m.div animate={{ scale: 2 }} /> </LazyMotion> )}// Asynchronous loadingimport { LazyMotion, m } from "framer-motion"function App() { return ( <LazyMotion features={() => import('./path/to/domAnimation')}> <m.div animate={{ scale: 2 }} /> </LazyMotion> )} Copy
// Synchronous loadingimport { LazyMotion, m, domAnimation } from "framer-motion"function App() { return ( <LazyMotion features={domAnimation}> <m.div animate={{ scale: 2 }} /> </LazyMotion> )}// Asynchronous loadingimport { LazyMotion, m } from "framer-motion"function App() { return ( <LazyMotion features={() => import('./path/to/domAnimation')}> <m.div animate={{ scale: 2 }} /> </LazyMotion> )}
Generated using TypeDoc
Used in conjunction with the
mcomponent to reduce bundle size.mis a version of themotioncomponent that only loads functionality critical for the initial render.LazyMotioncan then be used to either synchronously or asynchronously load animation and gesture support.