ChatGPT on using one React Native codebase for mobile and web apps: promise vs. reality
React Native Has a Smaller Ecosystem than React (Web)
React (Web) has been around longer (since 2013) and has a huge open-source community building:
-
UI component libraries (MUI, Chakra, Ant Design)
-
Data handling tools (React Query, Apollo)
-
Form helpers, animations, charts, etc.
-
-
React Native (mobile) has more constraints:
-
It targets native platforms, not the DOM
-
It requires bridging to native code for many features (e.g., camera, Bluetooth, gestures)
-
Fewer contributors are comfortable working with both JS and native platforms (Java/Kotlin/Swift/Obj-C)
-
So yes — the volume and variety of high-quality npm packages for React Native is less than for React Web.
But It’s Not a Desert — React Native Has a Solid Core Ecosystem
While smaller, React Native still has many well-maintained, powerful libraries, including:
-
Navigation:
@react-navigation/native -
Forms:
react-hook-form,formik -
Gestures:
react-native-gesture-handler,react-native-reanimated -
Auth:
expo-auth-session,react-native-firebase/auth -
Image/Video:
react-native-fast-image,expo-av -
Camera:
expo-camera,react-native-vision-camera -
Storage/SQLite:
@react-native-async-storage/async-storage,expo-sqlite -
Charts:
react-native-svg,react-native-chart-kit -
Maps:
react-native-maps
And Expo packages (expo-blur, expo-file-system, expo-image-picker) simplify access to native APIs without writing native code.
Component Libraries Are Improving Too
Some good UI kits for React Native:
-
NativeBase
-
React Native Paper
-
Tamagui (cross-platform, supports web too)
-
Shadcn (early work in progress for Native)
React Native for Web Helps — But With Limits
If you use React Native for Web or Expo for Web, you can:
-
Reuse your React Native components on web
-
But you can’t just use any React DOM package (e.g., MUI won’t work out-of-the-box)
That’s because React Native uses View/Text, not div/span, and many DOM packages assume HTML/CSS.
Promise and reality of using React Native for mobile and web
The Ideal Vision (Marketed by Expo & RN for Web)
“One codebase, three platforms: Android, iOS, and Web.”
-
Use React Native as the base
-
Add React Native Web
-
Use libraries that work cross-platform (e.g., Tamagui, Expo SDK)
-
Write platform-specific code only when necessary (
Platform.OSor.android.js,.web.jsfiles)
This can work well for simple to moderate apps — especially if you plan for cross-platform from day one.
The Realistic Scenario for Most Teams
“React Native for mobile, React for web” — two separate codebases with shared business logic at best.
Why?
1. Different UI Expectations
-
Mobile UI is gesture-driven, smaller screens, native patterns
-
Web has mouse/keyboard input, larger layouts, different navigation paradigms
2. Component Compatibility
-
Many React libraries are DOM-focused (use HTML/CSS/Browser APIs)
-
Many React Native components don’t exist on web without a special wrapper (
React Native Web)
3. Complex Web Needs
-
Table-heavy dashboards, rich editors, charts, data grids — much easier with React + web ecosystem
-
Hard to replicate that cleanly in React Native Web
4. SEO & SSR
-
If you need SEO (for marketing/public web), React Native Web doesn't help
-
Frameworks like Next.js are much better for SSR and SEO
✅ Recommended Approach (in most real-world projects)
| App Type | Best Approach |
|---|---|
| Consumer mobile app | React Native (iOS/Android only) |
| Consumer mobile + simple web app | React Native + React Native Web via Expo |
| Full-featured web app | Separate React (Web) codebase |
| Shared business logic | Use a shared JS/TS library for core logic (optional) |
Final Take
You're right:
-
React Native excels at cross-platform mobile (iOS + Android).
-
Web support is promising but not mature enough for many serious web use cases.
-
Having separate codebases for mobile and web is still the more pragmatic and scalable approach for most teams — even if there's some shared logic.
That said, if you're working with a shared UI design and Expo, you can build and maintain a unified codebase for web and mobile — with some compromises.
==== end of chat extracts ====
Comments
Post a Comment