React Native Explained: One Codebase, Two App Stores

A small shop wants an app on both app stores. Building it twice means two teams, two codebases, and every new feature written, tested, and fixed in two places. Building it once in a web view means it looks slightly wrong everywhere, with scrolling and buttons that feel slightly wrong. This is the gap React Native was built for: write the app once in JavaScript, and ship real native controls on both phones from that single codebase. It is not magic. JavaScript is the language the app is written in, as shown in JavaScript Explained: The Language That Runs the Whole Web. The shared code covers most of the app, and somebody still has to test on real phones. The question is whether your app is the kind where sharing helps more than it hurts.

Quick answer

React Native lets you write an app once in JavaScript and ship real native controls on both iPhone and Android from that single codebase. It fits a shop, booking, or content app that is mostly screens, lists, forms, and API calls, especially when the team already knows JavaScript and React. Do not use it for a game, a video editor, or an app that needs the newest phone features on launch day, where building natively is the better bet.

What I would check before using it

My judgement is that React Native is the right call when the app is mostly screens, lists, forms, and API calls, and the team already knows JavaScript and React. That covers most shop apps, booking apps, and content apps, and it is where the sharing pays off: one feature, one test, two stores.

Before committing, I would check four things. First, the platform specific parts: payments, maps, cameras, and push notifications all have native quirks, so list the features that need the phone itself and check that a maintained library exists for each one on both platforms. Second, the team's native skills: someone will eventually need to open the iOS and Android projects, read a native error, and update a build setting, so the team needs at least one person willing to do that. Swift is the language behind the iOS side of that native work, as shown in Swift Explained: Apple's Language for iPhone, Mac, and More. Third, the release process: two stores means two review processes, two sets of screenshots, and two accounts, and none of that disappears when the code is shared. Fourth, performance: long scrolling lists and animations need testing on a cheap Android phone, not only on the newest iPhone, because that is where a sluggish app shows up first.

The verdict is simple: choose it for a standard app with a JavaScript team, and keep a native escape route for the few features that need it. The recommendation flips in two cases. If the app is heavily graphical, like a game or a video editor, or if it needs the newest phone features on launch day, build natively and accept the cost of two codebases. And if the team has no JavaScript experience at all, the learning curve eats the savings from sharing, and native development in the language the team already knows is the better bet.

A worked example that is not a toy

Here is the core of a small shop app: a product list, a filter for what is in stock, and a cart total. This is the logic the whole screen depends on, and it is the same on both phones, which is exactly why it lives in the shared code.

import { FlatList, Text, View } from "react-native";

function ProductList({ products }) {
  const inStock = products.filter((p) => p.inStock);
  return (
    <FlatList
      data={inStock}
      keyExtractor={(p) => p.id}
      renderItem={({ item }) => (
        <View>
          <Text>{item.name}</Text>
          <Text>{formatPrice(item.price)}</Text>
        </View>
      )}
    />
  );
}

The component above is source code, not something I ran, because running it needs a phone or an emulator, and neither was available here. What I did run, under Node, is the logic the component depends on: the same product data, the same filter, the same total. Real apps fail in this logic far more often than in the rendering, so verifying it first is the right order.

const products = [
  { id: "p1", name: "Trail Shoes", price: 89.99, inStock: true },
  { id: "p2", name: "Rain Jacket", price: "129.50", inStock: true },
  { id: "p3", name: "Trail Socks", price: 12.0, inStock: true },
  { id: "p4", name: "Camp Mug", price: 18.25, inStock: false },
];

function formatPrice(amount) {
  return "$" + Number(amount).toFixed(2);
}

function available(list) {
  return list.filter((p) => p.inStock);
}

function cartTotal(items) {
  return items.reduce((sum, p) => sum + p.price, 0);
}

const inStock = available(products);
console.log("In stock:", inStock.map((p) => p.name).join(", "));
console.log("Raw total:", cartTotal(inStock));
console.log("Type of raw total:", typeof cartTotal(inStock));

The output showed something going wrong, and it is a classic cross platform trap:

In stock: Trail Shoes, Rain Jacket, Trail Socks
Raw total: 89.99129.5012
Type of raw total: string

The Rain Jacket price arrived from the API as the string "129.50", not a number, and JavaScript happily glued the numbers together into a string instead of adding them. The cart total on the screen would have read 89.99129.5012, and the customer would have seen nonsense. Postman is the tool for testing that API before the frontend exists, as shown in Postman Explained: Testing APIs Before the Frontend Exists. The fix is to convert every price to a number at the boundary, before any maths happens:

function cartTotal(items) {
  return items.reduce((sum, p) => sum + Number(p.price), 0);
}

Running the fixed version gave the real answer:

In stock: Trail Shoes, Rain Jacket, Trail Socks
Total: $231.49
Type of total: number
Item prices: Trail Shoes $89.99, Rain Jacket $129.50, Trail Socks $12.00

The total is right: 89.99 plus 129.50 plus 12.00 is 231.49, and the out of stock Camp Mug is correctly left out. The lesson travels with the code: the same shared logic runs on both phones, and the same string price bug would have appeared on both phones too. Finding it once, in Node, fixed it everywhere.

Common mistakes and how to fix them

1. Trusting data from the API without checking its types. The symptom is a total like 89.99129.5012, or a price that sorts wrong, and the cause is a number arriving as a string. The fix is to convert values with Number() where the data enters your code, and to log typeof the value when a total looks wrong. TypeScript is the tool that types those API responses so a string price cannot slip through as a number, as shown in TypeScript Explained: Types That Catch Bugs Before They Run.

2. Testing only on one platform. The symptom is a layout that looks fine on iOS and broken on Android, or a feature that works on one phone and crashes on the other. The fix is to run the app on a real Android device from the first week, not only in the iOS simulator, and to test scrolling lists on a cheap phone.

3. Assuming the shared code covers everything. The symptom is a feature that works in the JavaScript layer but fails at the native boundary, like a camera permission or a payment sheet that behaves differently per store. The fix is to list the native features before starting, check the library support on both platforms, and keep one person on the team comfortable opening the native projects.

Frequently Asked Questions

What is React Native?

React Native is a framework for building mobile apps in JavaScript that ship real native controls on iPhone and Android from one codebase. The shared code covers the screens and logic that are the same on both phones, while native work handles the parts that genuinely differ. It is a practical trade, not a shortcut: you write once, but you still test on real phones.

When should I use React Native?

Use React Native for a standard app that is mostly screens, lists, forms, and API calls, especially when the team already knows JavaScript and React. That covers most shop apps, booking apps, and content apps, where one feature and one test serve two stores. Do not use it for a game or a video editor, or when the app needs the newest phone features on launch day.

Why does my cart total show a number like 89.99129.5012?

A price arrived from the API as the string "129.50" instead of a number, and JavaScript glued the values together into a string instead of adding them. The fix is to convert every price to a number with Number() where the data enters your code, before any maths happens. Log typeof the value whenever a total looks wrong, so the bad type shows up at once.

Why does my app look fine on iOS but break on Android?

Testing only on one platform hides the differences: a layout that looks fine on iOS can break on Android, and a feature can work on one phone and crash on the other. Run the app on a real Android device from the first week, not only in the iOS simulator, and test scrolling lists on a cheap phone. Long lists and animations show sluggishness first on a cheap Android phone, not on the newest iPhone.

Where this leaves you

React Native is a practical trade, not a shortcut: one codebase for the screens and logic that are the same on both phones, and native work for the parts that genuinely differ. It fits a shop app, a booking app, or any app that is mostly lists and forms, and it fits badly for games and apps that live on the newest phone hardware. If your app fits the first group, the next step is to build one real screen with real data, run it on a cheap Android phone and an iPhone, and check the list scrolling and the totals before committing to the whole app. That screen will tell you more than any comparison.

Further reading

Comments

Popular posts from this blog

Swift Explained: Apple's Language for iPhone, Mac, and More

LangChain Tutorial: Build Your First LLM App in Python

Rust Explained: Memory Safety Without a Garbage Collector