Mohamed GhoniemWeb Developer
MohamedGhoniem
  • Work
  • Services
  • Experience
  • Blog
Available
CV
Open to opportunities
WorkServicesExperienceBlogDownload CV
All blogs

© 2026 Mohamed Ghoniem. All rights reserved.

TwitterGitHubLinkedIn
React Query vs. SWR vs. Zustand: picking the right state tool
DesignFrontend
All blogs

React Query vs. SWR vs. Zustand: picking the right state tool

MG
Mohamed Ghoniem
·July 16, 2026·8 min read

Prefer to watch?

This article has a full video walkthrough on YouTube

Watch the same walkthrough on YouTube.

Client vs Server State

One of the biggest sources of complexity in React applications is mixing server-side state (fetched databases, user sessions) with client-side state (sidebar toggles, modal indicators, current form fields).

The React Query paradigm

React Query (or SWR) handles caching, polling, deduplication, and loading/error states for server data, leaving client state management tools like Zustand or Context to handle local UI variables.

javascript
import { useQuery } from '@tanstack/react-query'

function UserProfile() {
  const { data, isLoading, error } = useQuery({
    queryKey: ['userProfile'],
    queryFn: fetchUserProfile
  })

  if (isLoading) return <div>Loading profile...</div>
  if (error) return <div>Error fetching data</div>

  return <div>Welcome back, {data.name}</div>
}
On this page8 min left
Client vs Server StateThe React Query paradigm

Share

On this page8 min left
Client vs Server StateThe React Query paradigm

Written by

Mohamed Ghoniem

I build fast, responsive web experiences, from pixel-perfect UI to the backend behind it.

Get in touchAll posts
Newer postCSS architecture at scale: BEM vs. utility-first vs. CSS Modules
Keep reading
Building a design system from scratch with Figma tokens & Tailwind
DesignFrontendJuly 16, 2026

Building a design system from scratch with Figma tokens & Tailwind

A practical walkthrough of how I set up a token-driven design system that stays in sync between Figma and code — no plugin lock-in, no manual updates.

MG
Mohamed G.
8 min read
The hidden cost of unoptimized images in Next.js
DesignFrontendJuly 16, 2026

The hidden cost of unoptimized images in Next.js

A practical walkthrough of how I set up a token-driven design system that stays in sync between Figma and code — no plugin lock-in, no manual updates.

MG
Mohamed G.
5 min read
JWT refresh token rotation — the right way
DesignFrontendJuly 16, 2026

JWT refresh token rotation — the right way

A practical walkthrough of how I set up a token-driven design system that stays in sync between Figma and code — no plugin lock-in, no manual updates.

MG
Mohamed G.
6 min read