{"slug": "next-js-to-mobile-what-carries-over-to-react-native-and-when-flutter-wins", "title": "Next.js to Mobile: What Carries Over to React Native (and When Flutter Wins)", "summary": "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.", "body_md": "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.\n\nThat 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.\n\nReact 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:\n\n```\napps/\n  web/        # Next.js\n  mobile/     # Expo\npackages/\n  shared/     # schemas, api client, hooks, formatters\n```\n\nExpo 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.\n\nUI 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.\n\nNothing 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.\n\nLists 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.\n\nServer 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.\n\nExpo 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.\n\nIf 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:\n\n```\n// packages/shared/src/orders.ts\nexport async function createOrder(input: unknown, userId: string) {\n  const data = orderSchema.parse(input);\n  return db.order.create({ data: { ...data, userId } });\n}\n// apps/web/app/actions.ts\n\"use server\";\n\nexport async function createOrderAction(input: unknown) {\n  const user = await getSessionUser();\n  return createOrder(input, user.id);\n}\n// apps/web/app/api/orders/route.ts\nexport async function POST(req: Request) {\n  const user = await getBearerUser(req);\n  return Response.json(await createOrder(await req.json(), user.id));\n}\n```\n\nThe server action and the API route become thin wrappers. This costs almost nothing now and avoids a rewrite later.\n\nAuth 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.\n\nFlutter 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.\n\nWhat 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.\n\nI'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.\n\nUpgrades 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.\n\nThe 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](https://hasnainalam.com/blog/nextjs-developer-react-native-or-flutter).", "url": "https://wpnews.pro/news/next-js-to-mobile-what-carries-over-to-react-native-and-when-flutter-wins", "canonical_source": "https://dev.to/hasnain_alam/nextjs-to-mobile-what-carries-over-to-react-native-and-when-flutter-wins-1gpb", "published_at": "2026-12-06 14:29:49+00:00", "updated_at": "2026-12-06 14:44:41.432028+00:00", "lang": "en", "topics": ["developer-tools"], "entities": ["Next.js", "React Native", "Flutter", "Expo", "Zod", "TanStack Query", "Zustand", "Shopify"], "also_reported_by": [], "takeaway": "Put DOM-free logic — Zod schemas, API clients, TanStack Query hooks and Zustand stores — in a shared monorepo package and wrap it with thin server actions and API routes so a future React Native app can reuse it without a rewrite.", "recommendation": {"advice": "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.", "playbook": "agent-architecture", "playbook_url": "https://wpnews.pro/playbooks/agent-architecture"}, "alternates": {"html": "https://wpnews.pro/news/next-js-to-mobile-what-carries-over-to-react-native-and-when-flutter-wins", "markdown": "https://wpnews.pro/news/next-js-to-mobile-what-carries-over-to-react-native-and-when-flutter-wins.md", "text": "https://wpnews.pro/news/next-js-to-mobile-what-carries-over-to-react-native-and-when-flutter-wins.txt", "jsonld": "https://wpnews.pro/news/next-js-to-mobile-what-carries-over-to-react-native-and-when-flutter-wins.jsonld"}}