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/no-unused-prop-types false positives with props closure #2171

Closed
a-x- opened this issue Feb 20, 2019 · 2 comments
Closed

react/no-unused-prop-types false positives with props closure #2171

a-x- opened this issue Feb 20, 2019 · 2 comments

Comments

@a-x-
Copy link

a-x- commented Feb 20, 2019

it's similar to #2155, but w/o passing via arguments.

I created bug-repro-repo: https://github.com/a-x-/eslint-memo-props-check

In my case props passed as closure w/o function arguments
brief:

function Foo (props) {
  // setup hooks: useState,,,
  return <div>{ renderPhoto() }</div>;

  function renderPhoto () {
    return <div>{ props.renderPhotoTools() }</div>;
  }
  // handlers
}
@ljharb
Copy link
Member

ljharb commented Feb 20, 2019

This is very strange - why would you want to create a new renderPhoto function on every render of Foo, rather than hoisting it outside?

Either way, this should indeed work.

@a-x-
Copy link
Author

a-x- commented Feb 22, 2019

because of closure and multiple variables.
anyway, I'll think about you point too, thank you

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