You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
React 19 allows both useContext(MyContext) and use(MyContext) (announcement | docs). Unlike useContext, use can be used conditionally.
Describe the solution you'd like
I’d like to maintain consistency in the codebase and ban useContext because it does a subset of what use can do. It’d be great to have a new auto-fixable rule, e.g. @eslint-react/prefer-use or @eslint-react/no-use-context. This rule would be somewhat similar to @eslint-react/no-forward-ref / @eslint-react/no-context-provider which help to embrace new React 19 features.
Alternatives considered
It is possible to ban useContext via no-restricted-syntax but that’s harder to configure and there is no auto-fix.
Additional context
No response
The text was updated successfully, but these errors were encountered:
Describe the problem
React 19 allows both
useContext(MyContext)
anduse(MyContext)
(announcement | docs). UnlikeuseContext
,use
can be used conditionally.Describe the solution you'd like
I’d like to maintain consistency in the codebase and ban
useContext
because it does a subset of whatuse
can do. It’d be great to have a new auto-fixable rule, e.g.@eslint-react/prefer-use
or@eslint-react/no-use-context
. This rule would be somewhat similar to@eslint-react/no-forward-ref
/@eslint-react/no-context-provider
which help to embrace new React 19 features.Alternatives considered
It is possible to ban
useContext
via no-restricted-syntax but that’s harder to configure and there is no auto-fix.Additional context
No response
The text was updated successfully, but these errors were encountered: