Rule proposal:no-unnecessary-setstate - forbid setting state to the value of the existing state variable
I've seen this pattern also a bunch from beginners. And regardless of whether you're a beginner or not, this is probably not what you want to do (even if it's an object / array).
Rule proposal:
no-unnecessary-setstate
- forbid setting state to the value of the existing state variableI've seen this pattern also a bunch from beginners. And regardless of whether you're a beginner or not, this is probably not what you want to do (even if it's an object / array).
Example of incorrect code:
Examples of correct code: