Skip to content

No lambda in JSX and lamda ref conflict #33

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

Closed
isergey opened this issue Oct 2, 2016 · 3 comments
Closed

No lambda in JSX and lamda ref conflict #33

isergey opened this issue Oct 2, 2016 · 3 comments

Comments

@isergey
Copy link

isergey commented Oct 2, 2016

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
Copy link
Contributor

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
Copy link
Contributor

Also see #26

@jkillian
Copy link
Contributor

jkillian commented Oct 5, 2016

Closing as there's no action to take here

@jkillian jkillian closed this as completed Oct 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants