Hi! This is Code - your guide in the world of programming. We not only analyze new tools, but also share life hacks in our Telegram channel — Come on in, there are already 1500+ developers discussing fresh features and sharing their experiences.
The problem of excessive useEffect
React gave us the useEffect hook a long time ago, and it has become a universal "Swiss knife" for side effects. But there is a side effect: developers often use it where it is not needed at all.
👉 As a result, the code turns into a mess: a bunch of subscriptions, unnecessary re-renders, and dependencies that break your head.
👉 But in many cases, you can do simple calculations or memoization.
What does the plugin do?
The ESLint plugin eslint-plugin-you-might-not-need-an-effect appeared as a remedy for the habit of "stuffing everything into useEffect".
It analyzes your code and tells you when useEffect is redundant. For example:
❌ Excessive use of useEffect only to calculate the value → better useMemo.
❌ Updating the state inside the effect without dependency → hello infinite loop.
❌ Side effects that can be taken directly to the render or callback.
Examples of rules are described below:
Example 1: Extra useEffect
// Bad
useEffect(() => {
setValue(a + b);
}, [a, b]);
// Good
const value = a + b;
Example 2: Memoization instead of effect
// Bad
useEffect(() => {
const filtered = items.filter(fn);
setFiltered(filtered);
}, [items, fn]);
// Good
const filtered = useMemo(() => items.filter(fn), [items, fn]);

How does it help?
The code becomes cleaner and more predictable.
Fewer unnecessary renders → higher performance.
You begin to understand better, where a side effect is really needed, and where is this "crutch".
useEffect is a powerful tool, but its reuse leads to chaos. Plugin you-might-not-need-an-effect helps you "catch yourself by the hand" and learn how to write React components more easily.
Try to put it in your project — and you will see how the code becomes cleaner.
More such reviews in our Telegram channel - there we discuss new plugins, share courses and analyze fresh trends in development.
