{}const=>[]async()letfn</>var
Development

Don't need useEffect? The ESLint plugin that makes the code cleaner

Let's take a look at the you-might-not-need-an-effect plugin: why it is needed, how it helps to get rid of unnecessary useEffect in React and write cleaner, predictable code.

К

Kodik

Author

2 min read

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.

🔥 100,000+ students already with us

Tired of reading theory?
Time to code!

Kodik — an app where you learn to code through practice. AI mentor, interactive lessons, real projects.

🤖 AI 24/7
🎓 Certificates
💰 Free
🚀 Start learning
Joined today

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?

  1. The code becomes cleaner and more predictable.

  2. Fewer unnecessary renders → higher performance.

  3. 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.

🎯Stop procrastinating

Liked the article?
Time to practice!

In Kodik, you don't just read — you write code immediately. Theory + practice = real skills.

Instant practice
🧠AI explains code
🏆Certificate

No registration • No card