Writing
I write short notes on tools and habits that help with day-to-day engineering.
2026
- Add optimistic UI with useOptimisticShow a like while a React action saves it and return to the confirmed value if the request fails.
- Stream comments with React use()Pass a promise from a Server Component and let a Suspense boundary handle the wait while the rest of the page renders.
- Render a React context as its providerRender a context object as a provider in React 19 and keep the same value, readers and nested overrides.
- Render document metadata from React componentsSet a route’s title and description next to its data with React 19 document metadata.
- Preload a font and initialize a scriptUse preload for a font and preinit for a classic script that can execute as soon as it downloads.
- Handle form errors with useActionStateReturn field errors from a React form action and keep the submitted input available for a retry.
- Return cleanup functions from ref callbacksAttach a ResizeObserver with a React 19 callback ref, return its disconnect function, and test setup and cleanup when the element unmounts.
- Where to put the React client boundaryPut 'use client' on the interactive leaf of a Server Component page and pass serializable props from the server module.
- require() ES modules from CommonJSUse require() to read a synchronous ESM namespace from CommonJS, and recognize when top-level await means you need dynamic import.
- Keep browser exports when upgrading to Vite 6Check custom resolve.conditions before upgrading to Vite 6 so packages with conditional exports keep their intended browser entry in your bundle.
- Build your first MCP server toolRegister a local MCP tool with a small input schema, then use a stdio client to list it and verify one result.
- Type Object.groupBy with the ES2024 libraryAdd ES2024 declarations for Object.groupBy without changing TypeScript's emit target, then handle missing groups and check support in your runtime.
- Rewrite .ts import paths on emitWrite relative .ts imports for source execution and emit runnable .js imports with TypeScript's rewriteRelativeImportExtensions option.
- Snapshot page structure with ARIA snapshotsUse a Playwright ARIA snapshot to check navigation roles and link names while letting layout markup change.
- Move from framer-motion to motion/reactReplace framer-motion with the motion package, update React imports, and check your existing animation entry points after the migration.
- Check stream backpressure before upgrading NodeRun the same stream probe on Node 20 and 22, then check where write starts returning false before switching production traffic.
- Boost the LCP image with fetchpriorityRaise the fetch priority of your LCP image, lower eager offscreen images, and compare their initial priorities in Chrome DevTools.
- Animate height: auto with interpolate-sizeUse interpolate-size to transition a disclosure from zero to its content height, with an instant fallback and reduced-motion support.
- Migrate ESLint rules to BiomeConvert an ESLint config with Biome, then verify the generated rules against files that should pass and fail before switching CI.
- Split TypeScript emit with --noCheckSplit JavaScript emit from type checking with tsc --noCheck, then require both CI jobs before you release a build.