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

update no-string-refs.md? #393

Closed
nickzarate opened this issue Jan 13, 2016 · 1 comment
Closed

update no-string-refs.md? #393

nickzarate opened this issue Jan 13, 2016 · 1 comment

Comments

@nickzarate
Copy link

No-string-refs.md makes the distinction between valid and invalid use of refs:
Invalid:

var Hello = React.createClass({
  componentDidMount: function() {
    var component = this.refs.hello;
    // ...do something with component
  },
  render: function() {
    return <div ref="hello">Hello, world.</div>;
  }
});

Valid:

var Hello = React.createClass({
  componentDidMount: function() {
    var component = this.hello;
    // ...do something with component
  },
  render() {
    return <div ref={c => this.hello = c}>Hello, world.</div>;
  }
});

However, the valid method described produces another warning "react/jsx-no-bind". No-string-refs.md may need to be updated so as to illustrate how to properly use refs without either warning?

@nickzarate nickzarate changed the title no-string-refs.md update no-string-refs.md? Jan 13, 2016
@nickzarate
Copy link
Author

Sorry I did not see issue #330, so I am closing mine.

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

No branches or pull requests

1 participant