Eslint-plugin-react: React ForwardRef in combination with react/no-multi-comp

Created on 21 Feb 2019  路  3Comments  路  Source: yannickcr/eslint-plugin-react

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?

bug help wanted react 16

Most helpful comment

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

All 3 comments

indeed it should; same with memo or lazy.

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

Nope, go for it.

Was this page helpful?
0 / 5 - 0 ratings