motion icon indicating copy to clipboard operation
motion copied to clipboard

Documentation wrongly suggests using motion.create for custom components

Open vincentreynaud opened this issue 1 year ago • 1 comments

The current Framer documentation suggests to create custom components in the following way:

const Component = React.forwardRef((props, ref) => (
    <div ref={ref} />
))

const MotionComponent = motion.create(Component);

when in fact one should use this, at least for the latest packages.

const MotionComponent = motion(Component);

Took me a bit to find out after encountering a few stack overflow issues.

Please fix the docs of an otherwise amazing library 🙏

vincentreynaud avatar Sep 11 '24 08:09 vincentreynaud

Did you try motion.create and it wasn't working?

mattgperry avatar Sep 18 '24 08:09 mattgperry

Ok so I believe it was throwing an error in my gatsby app previously. Lost track of what changed so that it doesn't throw errors anymore, but i managed to make both work now. Sorry for the false alert.

vincentreynaud avatar Oct 02 '24 09:10 vincentreynaud

Just updated my modules and saw that the motion function no longer works, same goes for motion.create image

But this way I can not use the library anymore with 3rd party UI components, since I can not control how these components are structured. Seems like the only way to use framer with 3rd party UI components is to create a new component, which then renders the UI component from the framework right?

manuelpoelzl avatar Oct 06 '24 17:10 manuelpoelzl