Rules
no-unnecessary-use-memo
Full Name in eslint-plugin-react-hooks-extra
Full Name in @eslint-react/eslint-plugin
Features
🔍
What it does
Disallows unnecessary usage of useMemo
.
React Hooks useMemo
has empty dependencies array like what's in the examples, are unnecessary. The hook can be removed and it's value can be calculated in the component body or hoisted to the outer scope of the component.
Examples
Failing
Passing
Implementation
See Also
no-unnecessary-use-callback
Disallows unnecessary usage ofuseCallback
.