/Practice

React Native in depth reels

React Native in depth1 / 2
1 / 4

Runtime may not exist

When the OS wakes your app for background work, it starts native code. Booting the JavaScript runtime costs time and memory the OS may not grant, and iOS offers no general way to run JS in the background at all.

2 / 4

Memory and bytes

Moving a large file through JavaScript means holding it in the JS heap, and a few hundred megabytes is enough to crash the app. Files should cross into native code only as a path.

3 / 4

Split

Keep screens, navigation and UI state in JavaScript. Put scheduling, transfers and ideally the sync engine in native modules. Native code writes progress into SQLite and JavaScript observes it, so both share one source of truth.

Interview answer

Say it in the interview

In React Native, JavaScript owns screens and state, while scheduling, transfers and the sync engine are native. Native code writes progress to SQLite and JavaScript observes it. File bytes never pass through the JS heap; only paths cross into native code.

Why JS can’t own background sync
#react-native
React Native in depth2 / 2
1 / 4

Level one: libraries

For an MVP, react-native-background-fetch or expo-background-task runs short JS jobs, a background upload library handles files, and WatermelonDB provides a sync protocol. It ships fast, but tight time budgets and JS start-up cost hold it back.

2 / 4

Level two: native modules

At scale, write Turbo Modules that expose enqueueSync and enqueueUpload. Android uses WorkManager underneath; iOS uses BGTaskScheduler and background URLSession. JavaScript only enqueues work and watches the database.

3 / 4

Level three: a shared core

Larger teams write the sync engine once, in Kotlin Multiplatform or Rust, and use it from the native Android app, the native iOS app and the React Native app. One protocol implementation and one test suite, with no drift between platforms.

In practiceApp Center CodePush was retired in March 2025; EAS Update is the usual replacement.
Interview answer

Say it in the interview

We started with background libraries for speed, then moved to Turbo Modules wrapping WorkManager and BGTaskScheduler as usage grew. With native apps alongside, I would put the sync core in Kotlin Multiplatform from day one to avoid drift between platforms.

Three levels of React Native sync
#react-native