Eslint-plugin-react: [feat-request] prefer-create-ref

Created on 12 Apr 2019  路  1Comment  路  Source: yannickcr/eslint-plugin-react

This is a feature request. In React it is possible to create references to elements in 3 different ways, including one deprecated (string refs, for this there is the no-string-refs rule). To improve consistency of what approach to be used for refs it would be nice to have a prefer-create-ref rule, maybe other naming also in favor of callback refs.

help wanted new rule

Most helpful comment

How about `ref-style, that separately controls string refs, callback refs, createRefs, and forwardRefs?

That way it could replace no-string-refs eventually, and is extensible to future styles.

>All comments

How about `ref-style, that separately controls string refs, callback refs, createRefs, and forwardRefs?

That way it could replace no-string-refs eventually, and is extensible to future styles.

Was this page helpful?
0 / 5 - 0 ratings