~/swaraj.dev
Back to all posts
January 15, 20262 min read

Next.js for Mobile Developers: Building the Web Companion App

If you know React Native, picking up Next.js is natural � here is how the mental models map and where they diverge.

next-jsreactjavascriptweb

The Overlap Is Huge

As a React Native developer, you already know the hardest parts of Next.js � React components, hooks, state management, and JSX. The gap is smaller than you think.

File-Based Routing

If you use expo-router, Next.js file routing feels identical:

# Next.js App Router        # expo-router (same idea)
app/                         app/
  page.tsx      -> /           index.tsx    -> Home
  blog/                        blog/
    page.tsx    -> /blog          index.tsx  -> Blog
    [slug]/                       [slug].tsx -> Blog post
      page.tsx  -> /blog/:slug

Server vs Client Components

This is the biggest mental shift. In React Native, everything runs on the client. In Next.js, components are server-rendered by default.

// Server Component � no hooks, direct DB/API access
export default async function BlogPage() {
  const posts = await fetchPosts(); // runs on server!
  return <PostList posts={posts} />;
}

// Client Component � add directive for interactivity
'use client';
export function LikeButton({ postId }) {
  const [liked, setLiked] = useState(false);
  return <button onClick={() => setLiked(true)}>Like</button>;
}

Styling: Tailwind CSS

No StyleSheet.create � just className strings.

// React Native
<View style={{ borderRadius: 12, padding: 16 }}>
  <Text style={{ fontSize: 20, fontWeight: 'bold' }}>Hello</Text>
</View>

// Next.js + Tailwind
<div className="rounded-xl p-4">
  <h2 className="text-xl font-bold">Hello</h2>
</div>

Shared Logic in a Monorepo

The real power: share API clients, types, and validation schemas between your mobile and web apps.

packages/shared/
  api/        <- Same fetch functions used in RN and Next.js
  types/      <- Shared TypeScript interfaces
  validation/ <- Zod schemas

Conclusion

For a React Native developer, Next.js is the natural pick for the web side of a product. React knowledge transfers directly � you mainly need to internalize the server/client component boundary.