You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there,
I found an issue with a React ref example. Inside a render() method you suggest to
pass your ref with the reference to the targetElement
But if we do so, we don't assign actually this.targetRef to the component and will always get a {current: null} from react ref.
Changed this.targetElement with this.targetRef worked for me.
render() {
return (
// change this.targetElement with this.targetRef to actually access a react ref
{/*<SomeOtherComponent ref={this.targetElement}>*/}
<SomeOtherComponent ref={this.targetRef}>
some JSX to go here
</SomeOtherComponent>
);
}
Please update the README example.
The text was updated successfully, but these errors were encountered:
Hi there,
I found an issue with a React ref example. Inside a
render()
method you suggest toBut if we do so, we don't assign actually
this.targetRef
to the component and will always get a{current: null}
from react ref.Changed
this.targetElement
withthis.targetRef
worked for me.Please update the README example.
The text was updated successfully, but these errors were encountered: