Skip to content

Support forwardRef in Tweenfu.div #7

@roackb2

Description

@roackb2

I was trying to create a ref in Tweenful.div, but it appears that the it's a function component wrapper, so React shows warnings as following:

Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?

In my constructor I created a ref

        this.container = React.createRef();

And this is my code using Tweenful.div

            <Tweenful.div
                ref={this.container}
                className="tween-box row ml-2 mb-2 mr-2 mt-2"
                duration={1500}
                easing={elastic(1, 0.25)}
                style={{ position: 'relative' }}
                animate={animate}>
                // child components
            </Tweenful.div>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions