jsx-no-string-ref
Passing strings to the ref prop of React elements is considered a legacy feature and will soon be deprecated. Instead, use a callback.
Maybe there even should be a new linter rule for this, to prevent you from using the callback style? Or the other way around, something like prefer-create-ref, to prevent string and callback refs?
From the rules section of the README.md
Not only is the anchor in the link outdated (should be https://reactjs.org/docs/refs-and-the-dom.html#callback-refs instead of https://reactjs.org/docs/refs-and-the-dom.html#the-ref-callback-attribute), but this linter should also encourage the use of the
React.createRef()
API introduced in React 16.3 instead of the callback, see https://reactjs.org/docs/refs-and-the-dom.html#creating-refs.Maybe there even should be a new linter rule for this, to prevent you from using the callback style? Or the other way around, something like
prefer-create-ref
, to prevent string and callback refs?