Rules
no-create-ref
Full Name in eslint-plugin-react-x
Full Name in @eslint-react/eslint-plugin
Presets
core
recommended
recommended-typescript
recommended-type-checked
Description
Disallow createRef
in function components.
createRef()
is a legacy API that is not recommended for use in new code. Instead, prefer using useRef()
with function components.
Examples
Failing
Passing
Implementation
Further Reading
See Also
no-string-refs
Disallows using deprecatedstring refs
.