Rules
no-use-context
Full Name in eslint-plugin-react-x
Full Name in @eslint-react/eslint-plugin
Features
🔄
Presets
core
recommended
recommended-typescript
recommended-type-checked
Description
Replaces usages of useContext
with use
.
In React 19, use
is preferred over useContext
because it is more flexible.
In addition, it is recommended to enable the naming-convention/context-name
rule to enforce consistent naming conventions for contexts.
Examples
Before
After
Implementation
Further Reading
See Also
no-context-provider
Replaces usages of<Context.Provider>
with<Context>
.no-forward-ref
Replace usages offorwardRef
with passingref
as a prop.