Skip to content
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

react/destructuring-assignment cannot detect in eventhandler #3102

Closed
hermanho opened this issue Oct 13, 2021 · 1 comment
Closed

react/destructuring-assignment cannot detect in eventhandler #3102

hermanho opened this issue Oct 13, 2021 · 1 comment

Comments

@hermanho
Copy link

Here is an example:

import React from 'react';

const TestComp = (props) => {
  props.onClick();

  return (
    <div
      onClick={(evt) => {
        if (props.onClick) {
          props.onClick(evt);
        }
      }}
    >
      <div />
    </div>
  );
};

export default TestComp;

Screenshot 2021-10-13 at 6 13 48 PM

Line 4 works as expected but no luck in line 9 and 10. Does it expected or bug?

@ljharb
Copy link
Member

ljharb commented Oct 13, 2021

It's a bug, it should be complaining in both cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants