#State Management

8 posts

React State Management in Depth #6: Which Tool, When — a Decision Guide
5 min read

React State Management in Depth #6: Which Tool, When — a Decision Guide

A single decision flow tying together the built-in tools, TanStack Query, Zustand, Jotai, and Redux Toolkit. The series wrap-up: what to reach for in which situation, and the common traps.

React State Management in Depth #5: Redux Toolkit and the Legacy Context
5 min read

React State Management in Depth #5: Redux Toolkit and the Legacy Context

Redux ruled an era and still lives in many codebases. We cover it in its currently recommended form, Redux Toolkit: slices, the store, useSelector, and where it stands in a new project.

React State Management in Depth #4: Jotai and the Atom Model
5 min read

React State Management in Depth #4: Jotai and the Atom Model

Jotai takes a bottom-up approach, breaking state into small atoms and composing them instead of using one store. A walkthrough of atoms, derived atoms, how useAtom behaves, and how it differs from Zustand.

React State Management in Depth #3: Lightweight Client State with Zustand
5 min read

React State Management in Depth #3: Lightweight Client State with Zustand

Share global client state with no Provider and minimal boilerplate using Zustand. Store creation, re-render optimization with selectors, and the persist middleware.

React State Management in Depth #2: Server State with TanStack Query
6 min read

React State Management in Depth #2: Server State with TanStack Query

Move the data fetching you wrote with useEffect and useState over to TanStack Query, and caching, refetching, and loading and error handling all come for free. A walkthrough of the core of useQuery and useMutation.

React State Management in Depth #1: Client State vs Server State
6 min read

React State Management in Depth #1: Client State vs Server State

Where useState alone starts to fall short, and a mental model for telling client state apart from server state. This is the starting point for choosing a state management tool.

Angular in Practice #4: State Management — Cleanup with SignalStore
10 min read

Angular in Practice #4: State Management — Cleanup with SignalStore

In the previous post, signal state was wired directly into ProductService. In this post, we move it to @ngrx/signals' SignalStore for cleanup. Step-by-step, we follow the flow of gathering state, derived values, methods, and lifecycle into one place using the four-piece set of withState/withComputed/withMethods/withHooks.

JavaScript Practice #5 Local Storage and Lightweight State Management
6 min read

JavaScript Practice #5 Local Storage and Lightweight State Management

How to use localStorage / sessionStorage and their pitfalls, plus patterns for managing UI state cleanly without a library.