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