Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React example is incorrect #109

Closed
rus-yurchenko opened this issue May 16, 2019 · 0 comments · Fixed by #121
Closed

React example is incorrect #109

rus-yurchenko opened this issue May 16, 2019 · 0 comments · Fixed by #121

Comments

@rus-yurchenko
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant