Skip to content

React ForwardRef in combination with react/no-multi-comp #2172

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

Closed
daviddelusenet opened this issue Feb 21, 2019 · 3 comments · Fixed by #2184
Closed

React ForwardRef in combination with react/no-multi-comp #2172

daviddelusenet opened this issue Feb 21, 2019 · 3 comments · Fixed by #2184

Comments

@daviddelusenet
Copy link

daviddelusenet commented Feb 21, 2019

When declaring a class like this:

class StoreListItem extends React.PureComponent {
  // A bunch of stuff here
}

And then add wrapping it in React.forwardRef like this:

export default React.forwardRef((props, ref) => <StoreListItem {...props} forwardRef={ref} />);

The ESLint react/no-multi-comp rule gets triggered. Shouldn't this code be allowed?

@ljharb
Copy link
Member

ljharb commented Feb 21, 2019

indeed it should; same with memo or lazy.

@jenil94
Copy link
Contributor

jenil94 commented Feb 26, 2019

@ljharb Anyone working on it? I would like to take a look at it.

@ljharb
Copy link
Member

ljharb commented Feb 26, 2019

Nope, go for it.

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

Successfully merging a pull request may close this issue.

3 participants