state-management

Zustand for lightweight state management

Zustand provides a minimalist alternative to Redux with less boilerplate and better TypeScript support. I create stores with create that hold state and actions. Unlike Context, Zustand doesn't cause unnecessary re-renders—components only update when t

SwiftUI declarative UI with state management

SwiftUI revolutionizes iOS development with declarative syntax where you describe what the UI should look like based on state. Views automatically update when state changes using property wrappers like @State, @Binding, and @ObservedObject. The @State

Context API for global UI state

While React Query handles server state, I use Context API for client-side UI state like theme, sidebar visibility, or current user. Each context lives in its own file with a custom hook for consuming it. The context provider wraps the app at a high le

React useReducer for complex state logic

useReducer manages state with reducer patterns like Redux but locally scoped. When state updates depend on previous state or involve multiple sub-values, reducers are clearer than multiple useState calls. The reducer function takes current state and a

React Query for server state management

React Query eliminates boilerplate for fetching, caching, and syncing server data. Instead of managing loading/error/data states manually with useState, I define queries with useQuery that handle caching, background refetching, and stale data automati