Skip to content

prop-types doesn't throw when accessing props in bound functions #420

Closed
@billyjanitsch

Description

@billyjanitsch
const MyComponent = props => (
  <div onClick={() => props.toggle()}>{props.label}</div>
)

There's some debate about the performance of binding functions in render, but, regardless:

The prop-types rule correctly identifies props.label as missing in validation, but fails to identify the same for props.toggle.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions