Just Use TanStack 🔥

Stop reinventing the wheel. Seriously.

You're still writing useEffect for data fetching?

It's 2025. You're still juggling loading, error, and data states manually like it's some kind of ritual. You're writing the same boilerplate for the 47th time this month.

const [data, setData] = useState(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);

useEffect(() => {
  let cancelled = false;
  setLoading(true);
  fetch('/api/users')
    .then(res => res.json())
    .then(data => { if (!cancelled) setData(data); })
    .catch(err => { if (!cancelled) setError(err); })
    .finally(() => { if (!cancelled) setLoading(false); });
  return () => { cancelled = true; };
}, []);

// 🤡 congratulations, you forgot cache invalidation

This is the hell you chose. And you haven't even handled refetching, cache invalidation, background updates, or what happens when the user switches tabs.

TanStack Query exists. Use it.

const { data, isLoading, error } = useQuery({
  queryKey: ['users'],
  queryFn: () => fetch('/api/users').then(r => r.json())
});

// ✅ Caching, refetching, deduplication, background updates
// ✅ All handled. Go take a nap.

Automatic caching. Background refetching. Stale-while-revalidate. Optimistic updates. Request deduplication. All out of the box.

Oh, you built your own table component?

Let me guess. It kind of works until someone asks for sorting. Then filtering. Then pagination. Then column resizing. Then virtual scrolling for 10,000 rows. Then your PM asks why it takes 3 seconds to render.

Meanwhile, TanStack Table has been headless, framework-agnostic, and battle-tested since before you started that project.

Using React Router? Cute.

TanStack Router gives you fully type-safe routes. Not "kind of typed." Not "we infer some things." Fully. Type. Safe. Your route params, search params, loaders — all typed end-to-end. TypeScript actually helps you instead of just yelling about missing semicolons.

The TanStack Ecosystem

Query

Async state management that doesn't make you cry

Table

Headless, powerful, extensible tables

Router

Type-safe routing that sparks joy

Form

Headless, performant forms

Virtual

Virtualize anything, anywhere

Start

Full-stack framework, batteries included

"But what about..."

"It's another dependency"

So is the 47 bugs you'll ship trying to replicate it. Pick your poison.

"I can just use SWR"

SWR is great. TanStack Query is greater. Mutations, infinite queries, SSR support, devtools. Fight me.

"Our company has its own solution"

I'm so sorry. Have you considered updating your LinkedIn?

"I want to learn how things work under the hood"

Read the TanStack source code. It's excellent. Then use TanStack anyway.

Stop wasting your life.

Your time is worth more than re-implementing solved problems.

Just Use TanStack →