palantir / tslint-react

:orange_book: Lint rules related to React & JSX for TSLint.
Apache License 2.0
749 stars 76 forks source link

No lambda in JSX and lamda ref conflict #33

Closed isergey closed 8 years ago

isergey commented 8 years ago

If ref defined as lamda, tslint warn about no lambda in JSX. But ref is string attr, tslint warn about callback to ref prop.

[tslint] Lambdas are forbidden in JSX attributes due to their rendering performance impact

<input type="input" ref={(c) => this._input = c} />

[tslint] Pass a callback to ref prop instead of a string literal

<input type="input" ref="input" />
adidahiya commented 8 years ago

This is intentional. The recommended pattern for satisfying the jsx-no-lambda rule is to bind your callback elsewhere, not inline. This is orthogonal to the jsx-no-string-ref rule.

adidahiya commented 8 years ago

Also see #26

jkillian commented 8 years ago

Closing as there's no action to take here