Evolving React - Don't Fix a Problem That Doesn't Need to Exist

Evolving React - Don't Fix a Problem That Doesn't Need to Exist

What if what we actually need is not a Hook?

It’s a provocative question in a world where Hooks are the foundation of modern React. But let's re-examine why we need them.

We need Hooks because we’ve forced our components to be "state-aware." We took the pure, simple idea of a functional component—a function that just turns props into UI—and mixed it with another world entirely: the impure, stateful, effect-driven world.

Hooks are the bridge. But this bridge comes at a cost.


The High Cost of a "Fix"

This "fix" introduced its own universe of complexity. To make this "mixed world" function, we now live by the Rules of Hooks. We have to master what I call "mighty boilerplate" just to make things work.

We constantly battle:

  • Dependency arrays
  • useMemo and useCallback for performance
  • Stale closures and useRef workarounds

This complexity exists only to manage the collision between the pure render function and the impure logic we’ve forced into it.

This model also locks us into React's coarse-grained re-rendering. Imagine you're a boss. Every time a single piece of information changes, you have to walk through all 30 floors of your building, checking on every single employee, just to find the one person who needs to do their job.

That's React's reconciler. It works, but it places the burden of optimization (with memo) squarely on us, the developers.

What if we didn't mix these worlds? The problem itself wouldn't exist.


Reimagine Component: Separation of Concerns

Let functional components be functional components. For our reactive, state-aware logic, we should use a model with a clear separation of concerns.

This is the philosophy I'm exploring. Instead of overloading a single function, we can separate the two jobs.

Article content
Reactive Component Model

This model is simple and powerful:

  • setup(): Runs only once. This is where all your logic, state, and effects live. Because it doesn't re-run, there are no dependency arrays, no stale closures, and no useCallback. The problems are gone.
  • view(): This is our pure presentation function. It's state-aware and reactively updates only when the exact state it reads changes.

This isn't just a stylistic choice; it fundamentally changes the game:

  1. Predictability: Logic is in setup, UI is in view. It's clean and easy to reason about.
  2. Scalability: This enables O(1) (constant time) updates. When state changes, it directly updates the DOM, regardless of tree size. Your app is scalable from day one, not after-the-fact optimization.
  3. Maintainability: The boilerplate is gone. The code becomes simpler, cleaner, and more readable.


Beyond Components: True Immutability

This philosophy extends to state management. For years, we've used "immutability by convention" with the spread syntax ({...}).

But this is fragile. It's hard to read and dangerously error-prone. We've all done this: { profile: { firstName: name } }

...and forgotten the top-level { ...user }, accidentally destroying our state. This isn't a "dumb" mistake; it's a human mistake, and our tools should prevent it.

True immutability means if something isn't meant to be changed, it can't be changed.

Compare that fragile convention with this enforcement-first model:

Article content
True Immutable State

It's clear, safe, and self-documenting. It's impossible to make the "forgotten spread" mistake.


Do We Still Need Hooks?

We've just outlined a model where:

  1. The component logic runs once, eliminating the need for useEffect, useCallback, and useMemo.
  2. The state management is truly immutable and safe, eliminating the need for complex useState or useReducer update patterns.

The very problems that Hooks were created to "fix"... simply don't exist here.

This is the entire philosophy behind my project, Anchor (https://anchorlib.dev). Learn more about this component model here.

Maybe the real evolution for React is to stop trying to fix a problem... that doesn't need to exist.

What are your thoughts on this? Have you felt this friction in React? Let's discuss in the comments.

To view or add a comment, sign in

More articles by Nanang Mahdaen El Agung

Others also viewed

Explore content categories