cd /news/developer-tools/next-js-to-mobile-what-carries-over-… · home › topics › developer-tools › article
[ARTICLE · art-182907] src=dev.to ↗ pub= topic=developer-tools verified=true sentiment=· neutral

Next.js to Mobile: What Carries Over to React Native (and When Flutter Wins)

A full-stack Next.js developer with five years of React experience argues that React Native with Expo carries over more from a Next.js codebase than Flutter, since hooks, TypeScript types, Zod schemas, API clients, TanStack Query hooks and Zustand stores can be shared in a monorepo package while UI components, server actions and cookie-based auth must be reworked. The developer recommends extracting business logic into plain functions or a tRPC router so server actions and API routes become thin wrappers, and notes Flutter requires rewriting the logic layer in Dart with no shared web code.

recommendation

Extract business logic into plain shared functions or a tRPC router now, then make server actions and API routes thin wrappers so mobile clients can call the same code later.

more in playbook: Designing agent systems
by read4 min views7 publishedDec 6, 2026

You can share your Zod schemas with a mobile app. You can't share your components, and you probably can't share your server actions until you refactor them.

That split decides whether React Native or Flutter costs less for someone coming from Next.js. I'm a full stack MERN and Next.js developer with five years of React behind me, and my pick is React Native with Expo. Flutter is good, and there are cases where I'd choose it. Below is the reasoning, including the parts that tend to surprise people.

React knowledge moves over intact: hooks, context, effects, memoization, how you split components. The reusable code is everything that doesn't touch the DOM. TypeScript types, Zod schemas, API client functions, TanStack Query hooks, Zustand stores, date and currency formatting, and permission checks all run the same on a phone. In a Turborepo monorepo, that code lives in one shared package:

apps/
  web/        # Next.js
  mobile/     # Expo
packages/
  shared/     # schemas, api client, hooks, formatters

Expo Router is file-based, so the App Router mental model still applies. Solito helps share links and screens between the two apps, and NativeWind lets you write Tailwind classes on native components.

UI components are the part you won't share. There is no <div> on a phone, so "write once, run on web and mobile" really means the logic layer. One more detail: next/image, next/link and next/font don't exist in React Native, so shared components can't import them. Keep those in the web app and pass them in.

Nothing from the DOM works. You write View, Text, Pressable and Image, and a raw string outside a Text component crashes the screen. Styling has no cascade and no hover, and flexbox defaults to column instead of row. Use StyleSheet objects or NativeWind, and expect to rebuild any layout that depends on CSS grid or complex selectors.

Lists need attention. Mapping 500 items inside a ScrollView is fine in a browser and janky on a mid-range Android phone. Use FlatList, or FlashList from Shopify for large lists. For storage, localStorage isn't available. MMKV covers fast general storage, and expo-secure-store is for tokens.

Server Components and Server Actions don't run on a phone. A native app needs HTTP endpoints. If your mutations live inside server actions, you have to extract that logic before mobile can call it.

Expo Router supports API routes, but React Server Components support in Expo was still experimental the last time I checked. I wouldn't build a client project on it, so check its status first.

If you know mobile is coming, write the business logic as plain functions (or a tRPC router) and let every entry point call it. Names below are placeholders:

// packages/shared/src/orders.ts
export async function createOrder(input: unknown, userId: string) {
  const data = orderSchema.parse(input);
  return db.order.create({ data: { ...data, userId } });
}
// apps/web/app/actions.ts
"use server";

export async function createOrderAction(input: unknown) {
  const user = await getSessionUser();
  return createOrder(input, user.id);
}
// apps/web/app/api/orders/route.ts
export async function POST(req: Request) {
  const user = await getBearerUser(req);
  return Response.json(await createOrder(await req.json(), user.id));
}

The server action and the API route become thin wrappers. This costs almost nothing now and avoids a rewrite later.

Auth is the other trap. Cookie sessions work well in a browser. Mobile usually wants a bearer token plus a refresh token in secure storage, so check that your auth library has a real mobile story before you commit.

Flutter means Dart, a new widget tree, a new state management ecosystem (Riverpod, Bloc, Provider), and no code shared with your web app. Zod schemas turn into Dart classes you write or generate. The API client is rewritten, and a logic bug gets fixed twice.

What you get is consistency. Flutter draws its own pixels instead of using native components, so the app looks the same on every device and OS version. That helps with heavy custom animation or a design system that ignores platform conventions. Flutter on the web renders to a canvas, not the DOM, which is a poor fit for SEO, text selection and accessibility. You wouldn't replace a Next.js site with it, so you end up running two stacks.

I'd choose it when the team is mostly Kotlin, Swift or Java developers who don't want TypeScript, when the product is mobile-only with a heavily custom UI, when you need desktop or embedded targets from one codebase, or when the design looks closer to a game interface than a standard app.

Upgrades hurt more than Next.js upgrades. The New Architecture became the default in 2024 and some older libraries lagged, so check a package's last update and New Architecture support before installing it. Stay on the versions Expo's SDK recommends. Expo Go stops working once you need a native module it doesn't include. Then you build a development build, which takes a while the first time.

The App Store side, signing certificates, EAS Build, EAS Update, and the one-screen test I use to check the cost are in my full guide: React Native or Flutter for Next.js developers, the full breakdown.

── more in #developer-tools 4 stories · sorted by recency
── more on @next.js 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/next-js-to-mobile-wh…] indexed:0 read:4min 2026-12-06 · —