Skip to main content
React 19Next.js 16Server ComponentsServer ActionsTypeScript

React 19 Server Components in Production: Patterns From OpenMyPro

How OpenMyPro uses React 19 Server Components, Server Actions, useActionState, and useOptimistic for a healthcare marketplace serving independent founders with zero-JS page loads.

Pablo Diaz·Founder & CEO, Blossend Inc·Ex-Amazon AWS Engineer

See this stack in production. bootstrapped revenue.

Free forever. Upgrade only when you're ready.

Ex-Amazon Engineer · Healthcare Innovation

No card charged today · Independent engineering · $0 to start

React 19 Server Components changed how I think about web architecture. Instead of shipping a JavaScript application that fetches data on the client, we ship pre-rendered HTML with surgical client interactivity only where needed. For OpenMyPro's healthcare marketplace, this means faster page loads, better SEO, and dramatically reduced bundle sizes. Here are the production patterns we use.

Server Components by Default

In the Next.js 16 App Router, every component is a Server Component unless you add "use client" at the top. This default is critical. It means the majority of our codebase — provider listings, search results, profile pages, blog posts — renders on the server and ships zero JavaScript to the browser. A patient searching for a therapist sees results in under 200ms because there is no JavaScript bundle to download, parse, and execute.

We have 147 components in the OpenMyPro codebase. Only 23 of them are client components. That means 84% of our UI ships as pure HTML with no client-side runtime. The remaining 16% are interactive elements that genuinely need browser APIs: the booking calendar, the map view, search filters with instant feedback, and form validation.

Server Actions for Mutations

Server Actions replaced our old API routes for data mutations. When a patient books an appointment, the form submission calls a server action that validates input, checks provider availability, creates the booking record, sends confirmation emails, and returns the result — all in a single server round trip. No API endpoint to define, no fetch call to write, no loading state to manage manually.

The pattern is clean: a server action function marked with "use server" receives FormData, processes it on the server, and returns a result that the calling component can use. We pair this with useActionState from React 19, which gives us pending state, error state, and result state without any custom state management.

useActionState for Form State

useActionState is the most underappreciated React 19 feature. It replaces the useState + useEffect + fetch pattern that every React developer has written hundreds of times. The hook takes a server action and initial state, returns the current state and a form action dispatch function. When the form submits, React automatically tracks the pending state, calls the server action, and updates the component with the result.

For our booking form, this eliminated approximately 40 lines of boilerplate state management. No loading boolean. No error state variable. No try-catch-finally in an async handler. The hook manages all of it, and the TypeScript types flow through from the server action return type to the component state.

useOptimistic for Instant Feedback

Healthcare booking requires instant feedback. When a patient clicks "Book Appointment," they need to see confirmation immediately — not a loading spinner. useOptimistic lets us update the UI optimistically while the server action processes in the background. If the server action succeeds, the optimistic update becomes the real state. If it fails, React automatically reverts to the previous state.

We use this pattern for provider favoriting, appointment status changes, and profile updates. The user sees instant feedback while the server handles the actual data mutation. Combined with server actions, this gives us a user experience that feels like a native app while running entirely on web standards.

The Client Component Boundary

Drawing the boundary between server and client components is the most important architectural decision in a React 19 app. Our rule is simple: push "use client" as far down the component tree as possible. A provider profile page is a server component that fetches data and renders layout. The booking button within that page is a tiny client component that handles click interaction. The page around it ships zero JavaScript.

This pattern means our largest client component is the booking calendar at approximately 8KB gzipped. Compare this to a traditional SPA approach where the entire page — layout, data fetching, rendering — would be client-side JavaScript. Our total client bundle for a provider profile page is under 15KB. A comparable Zocdoc page ships over 500KB of JavaScript.

Type Safety Across the Boundary

TypeScript strict mode ensures type safety even across the server-client boundary. Server actions have typed parameters and return types. Server components pass typed props to client components. The compiler catches any mismatch — passing a Date object across the boundary (not serializable), missing required props, or incorrect action return types — at build time rather than runtime.

Production Lessons

The shift to Server Components required rethinking component architecture. Components that previously managed their own data fetching now receive data as props from server parents. State that used to live in React context now lives in the URL (search parameters) or in server-side sessions. This simplification made our codebase more predictable and easier to reason about.

Frequently Asked Questions

What percentage of React components should be Server Components?

At OpenMyPro, 84% of components (124 out of 147) are Server Components shipping zero JavaScript. Only components needing browser APIs — calendars, maps, search filters, forms — use 'use client'. Push the client boundary as far down the component tree as possible for optimal performance.

What is useActionState in React 19?

useActionState is a React 19 hook that manages form state for server actions. It replaces the useState + useEffect + fetch pattern by automatically tracking pending state, error state, and result state. It eliminates approximately 40 lines of boilerplate per form while maintaining full TypeScript type safety.

How does useOptimistic work with Server Actions?

useOptimistic lets you update the UI instantly while a server action processes in the background. If the action succeeds, the optimistic update becomes permanent. If it fails, React reverts to the previous state. OpenMyPro uses this for booking confirmations, provider favoriting, and profile updates.

Ready to find the right AI tool? Our AI matching finds it in 33 seconds.

Independent engineering. 190+ providers. Book healthcare in 33 seconds — not 26 days.

Ex-Amazon Engineer · Healthcare Innovation

No card charged today · AI-powered matching · 33-second booking

Get Founder Insights Weekly

Startup lessons, technical deep dives, and behind-the-scenes of building a 14-platform ecosystem. No spam.

Find your provider in 33 seconds. Start free today.

Independent engineering. 190+ providers. Book healthcare in 33 seconds — not 26 days.

Ex-Amazon Engineer · Healthcare Innovation

No card charged today · Cancel anytime · strong LTV/CAC

OpenMyPro connects you with healthcare providers for instant appointments. Try it free →

Build your professional portfolio

Free to get started. No card charged today.

Get Started

Tools We Recommend

Find healthcare providers

AI-powered matching. Book a provider in 33 seconds.

Try OpenMyPro

Discover trending brands

Product Hunt-style brand discovery with AI insights.

Explore Brands

AI-Powered Healthcare Tech

Multi-platform marketplace network — 13 production platforms across healthcare, brand discovery, and content marketing.

Learn More

Ready to work together? Get in touch or explore our platforms.

More tools by the same team

Find Healthcare Providers Instantly

AI-powered matching. Book a therapist, trainer, or nutritionist in 33 seconds.

Try OpenMyPro Free

Work With Me

Get updates on new projects, tools, and tech insights.

No spam. Unsubscribe anytime.

Visit Blossend.com →

Explore the full portfolio of independent AI tools and editorial properties at blossend.com.