UI state وہ ڈیٹا ہے جو آپ کی ایپلیکیشن مقامی طور پر رکھتی ہے اور کنٹرول کرتی ہے (toggles، form inputs، selected tab)۔ Server state وہ ڈیٹا ہے جو سرور پر رہتا ہے اور client پر محض cached ہوتا ہے (fetched users، products، posts)۔ ان کی بنیادی طور پر مختلف خصوصیات ہیں اور انہیں مختلف ٹولز کی ضرورت ہے۔
کلیدی فرق
UI state Server state
Ownership you own it (client) the server owns it; client caches
Freshness always current can become STALE (server changed it)
Sync needed? no yes — refetch, invalidate, revalidate
Shared? usually one client shared across users/devices/tabs
Concerns just set/read it caching, loading, errors, retries, dedup
