Skip to content

jsx-no-bind should complain when using an arrow function #3114

@tkrotoff

Description

@tkrotoff

With eslint-plugin-react 7.26.1:

function OtherComponent({ onChange }) {
  return <input onChange={onChange} />;
}

function MyComponent_arrow() {
  // No error
  const doStuff = () => { ... };

  return <OtherComponent onChange={doStuff} />;
}

function MyComponent_function() {
  // Error "JSX props should not use functions  react/jsx-no-bind"
  function doStuff() { ... }

  return <OtherComponent onChange={doStuff} />;
}

Array function like regular function should display an error.

image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions