Archive

All posts

56 notes in the garden

  • Next.js in Practice · Part 2617 min read

    TanStack Query - Server Prefetch and Hydration

    A complete, copy-pasteable TanStack Query v5 setup for the Next.js 16.4.3 App Router - per-request clients, server prefetch with streamed pending queries, HydrationBoundary, useSuspenseQuery, mutations that invalidate both caches, Cache Components, and the pitfalls.

  • Next.js in Practice · Part 1020 min read

    Errors, Redirects and Request Lifecycle APIs

    How Next.js 16 turns thrown errors into UI and status codes (error.tsx, catchError, notFound, forbidden, unauthorized, redirect) and how the request lifecycle APIs after, connection, cookies, headers, draftMode and instrumentation.ts work under the hood.

  • Next.js in Practice · Part 2721 min read

    Server-Aware Auth - Sessions, Proxy and the DAL

    A complete cookie-session auth build for Next.js 16, covering encrypted sessions with jose, login and logout Server Actions, an optimistic check in proxy.ts, a Data Access Layer with verifySession, authorization in actions and Route Handlers, unauthorized() and forbidden(), and the rules for auth under Cache Components.

  • Next.js in Practice · Part 0816 min read

    Route Handlers and Proxy

    How route.ts handlers are dispatched and when a GET is prerendered, and how proxy.ts (the renamed middleware) runs before routing, matches paths and talks to the router through response headers.

  • How React Works · Part 098 min read

    Hooks: Why Order Matters

    Hooks have no names or keys; React stores them as an ordered list on each component's fiber and matches them by call position, which is the whole reason the Rules of Hooks exist.

  • How React Works · Part 047 min read

    State Updates: Snapshots and Batching

    Each render sees a fixed snapshot of state; calling a setter queues an update instead of changing a variable, and React batches every update from one event into a single render that runs after your handler returns.

  • How React Works · Part 129 min read

    A Click, Start to Finish

    One click on "Add" in the shopping list app, followed from the root listener through batched sync updates, rendering, keyed reconciliation and the commit to the moment the new item is painted.