Skip to content

Proposal new rule : jsx-no-lambda #2176

Closed
@VincentLanglet

Description

@VincentLanglet

Since tslint is going to be deprecated in favor of eslint and typescript-eslint. Some people (like me) are going to move from tslint-react to eslint-plugin-react.

I think the only missing rule in eslint-plugin-react is the jsx-no-lambda rule.

Creating new anonymous functions (with either the function syntax or ES2015 arrow syntax) inside the render call stack works against pure component rendering. When doing an equality check between two lambdas, React will always consider them unequal values and force the component to re-render more often than necessary.
Rule options: none

I think it is a good one to add.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions