We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
This is a mistake:
class MyComponent extends React.Component<{}, {}> { render() { return <button onClick={this.handleClick}>Click me!</button>; // ~~~~~~~~~~~~~~~~ passing unbound method } handleClick(e: any) { alert('You clicked!'); } }
There are many possible solutions, a few of which include:
onClick={this.handleClick.bind(this)}
onClick={e => this.handleClick(e)}
this.handleClick = this.handleClick.bind(this);
A lint rule would need to at least check for the last one to avoid false positives.
The text was updated successfully, but these errors were encountered:
this could potentially be a more general rule: palantir/tslint#259
Sorry, something went wrong.
this will be part of the next tslint release palantir/tslint#2089
no-unbound-method
closing as this is available in tslint core rules
No branches or pull requests
This is a mistake:
There are many possible solutions, a few of which include:
onClick={this.handleClick.bind(this)}
onClick={e => this.handleClick(e)}
this.handleClick = this.handleClick.bind(this);
in the constructorA lint rule would need to at least check for the last one to avoid false positives.
The text was updated successfully, but these errors were encountered: