react-tweenful
react-tweenful copied to clipboard
Support forwardRef in Tweenfu.div
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>
Oh, yeah, I haven't thought of that. You need the ref to access the div right? You'll push a fix these days.