There should be an eslint rule for "useless-client-component" #74520
Unanswered
jakeleventhal
asked this question in
App Router
Replies: 1 comment
-
Agreed. I'm working in a large codebase that makes liberal use of 'use client', and disentangling which of these are unnecessary (and auditing future NextJS projects) would be much easier with this rule. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Consider the case of a very simple component like this:
The developer then realizes that the state variable was useless and removes it and is left with:
Now the component is a client component, but there is no reason for it to be. There should be a lint rule that checks for a useless client component in this case.
Beta Was this translation helpful? Give feedback.
All reactions