React in Practice: React 19 Forms, Full-Stack TanStack Start, Resilient Components, Fast Tests, and Phone DeploysThematic roundup · digest for November 28
Engineering bench for resilient React architecture featuring form testing, server transitions, and test suite optimization
Thematic roundup5 sections≈ 6 min

React in Practice: React 19 Forms, Full-Stack TanStack Start, Resilient Components, Fast Tests, and Phone Deploys

In React, you usually trip over everyday details: a form wipes fields after an error, a sandbox fires false alerts, a component crashes inside a portal, or tests drag on for minutes. Here are five practical breakdowns with code and numbers.

Forms in React 19: onSubmit, action prop, or useTransition

The <form> action prop in React 19 skips event.preventDefault(), passes FormData to your handler, and runs inside a Transition (a non-urgent update that keeps the UI responsive). A comparison of three form approaches using a 1-second subscribe(email) form uncovered two gotchas.

First, React automatically resets uncontrolled inputs after action unless the function throws: catch a validation error without throw, and the user's input disappears. Second, setState calls after await inside a Transition are still urgent, so wrap setError and setSuccess in startTransition. Meanwhile, useFormStatus() from react-dom only reads pending from a child component inside <form>:

// Child component inside <form> reads submission status
function SubmitButton() {
  const { pending } = useFormStatus();
  return (
    <button type="submit" disabled={pending}>
      {pending ? "Sending..." : "Subscribe"}
    </button>
  );
}

// Wrap setState in a Transition again after await
async function handleAction(formData: FormData) {
  const res = await subscribe(String(formData.get("email")));
  startTransition(() => setError(res.ok ? null : res.message));
}

If you don't need progressive enhancement before JS loads (which works with server actions), onSubmit + useTransition is calmer: isPending sits right alongside, and you call form.reset() manually.

Why Base44 moved from SPA + functions to full-stack TanStack Start

Previously, the Base44 AI agent built apps as a Vite SPA paired with separate serverless functions. Code wasn't shared across functions, deployments split between static assets and functions, and public sites lacked SSR for SEO. Converting an SPA to full-stack "on demand" proved too expensive to maintain.

New projects now target TanStack Start and Cloudflare Workers for Platforms (legacy SPAs migrate separately). The framework fit three criteria: Vite, the React + TanStack React Query ecosystem, and support for SPAs alongside public SSR sites. In sandboxes, 99% of dev-server "crashes" were false alarms caused by health checks hitting a buggy home page. Switching to Vite's health ping dropped startup failures below 0.1%.

How to design 'bulletproof' React components

A component that works locally often breaks in SSR, double rendering, or an iframe. SWR co-author Shu Ding mapped out 10 levels of component resilience using ThemeProvider as an example.

At the base levels, never read localStorage during render (it breaks SSR); prevent theme flash during hydration ("waking up" server HTML) with a synchronous inline <script> before paint; and use useId() so two instances don't collide on id="theme". On the server, React.cache() deduplicates DB queries. Instead of React.cloneElement—which breaks with RSC, React.lazy, and "use cache"—use Context, and attach hotkeys in portals and iframes to the element's own window rather than window:

// Listen on the window where the element actually lives (portal or iframe)
const win = ref.current?.ownerDocument.defaultView || window;
win.addEventListener("keydown", toggle);
return () => win.removeEventListener("keydown", toggle);

Higher levels rely on React 19+: startTransition for <ViewTransition>, disabling <style> inside a hidden <Activity> via styleRef.current.media = 'not all' in useLayoutEffect, and experimental_taintUniqueValue (or taintObjectReference) to keep secrets out of client bundles. Those last three APIs are still experimental and won't fit every production React version.

Speeding up React Testing Library by embedding it in the DOM

Scott Cooper tested a faster-testing hypothesis: embed React Testing Library directly inside the DOM engine, bypassing the public DOM API and jsdom wrappers. The result is the MIT-licensed package @ctrl/dom.

Unmodified test suite run times: jsdom vs. @ctrl/dom

Real projects ran noticeably faster with zero test edits. Every node in @ctrl/dom is a flat NodeImpl object instead of a wrapper + impl pair, elements carry a numeric tag id, and the built-in @ctrl/dom/testing-library caches queries, accessible names, and styles against a document version counter.

In Vitest across 100 files, startup dropped from 259 ms in jsdom (147 ms in happy-dom) to 5.13 ms, and memory after the first test fell from 41 MB to 16 MB (111 MB vs. 171 MB by worker end). On a 4,004-element page, getByRole took 0.62 ms (0.08 ms cached) with zero matches() or getComputedStyle() calls, versus 28.3 ms / 13.4 ms (12,000 matches() and 2,007 getComputedStyle() calls) on jsdom 31.0.1 + @testing-library/dom 10.4.2. The project is brand new (8 stars), so test rare DOM APIs on your branch.

Fixing production from a phone: Expo's OTA deploy story

Out for a walk, Expo engineer Rami Maalouf spotted a bug in OpenMulticam (two liquid glass buttons clipped when pressed and dragged) and shipped the fix to production in this smartphone deployment walkthrough. Using mobile ChatGPT with the Expo MCP server (also supported in Claude and Grok), the agent opened PR #15 with a style fix, a test, and side-by-side swipe videos on two cloud iPhones in Expo Simulators (main and the fix branch).

After merging, two Expo Workflows shipped an OTA update—delivering the JS bundle and assets without App Review. The patch went to Expo Update's verify channel for cloud iPhone testing, then to production for App Store builds. This setup requires a GitHub repo, Expo GitHub App, Expo MCP, and GitHub chat integration. Expo Update is free, while Expo Simulators need a paid plan and an Apple Developer account—and native changes still require a full build and review.

Want a deep diveVotes help us choose what to break down in detail. This material has 0 votes.
Sources · 7