Under The Hood of React Native | Martin Konicek | Reactive 2015
Why Stack Overflow recommends it
Stack Overflow users link it when explaining React Native's architecture, such as the single JS thread, background native threads for networking, and the bridge between JavaScript and Java/Obj-C.
Recommended by 1 people across 1 different months, 2017 to 2018.
What it is
A 30-minute conference talk from Reactive 2015 by Martin Konicek, a Facebook London engineer who works on the Android side of React Native. It explains how React Native is architected under the hood, including its threading model and JavaScript bridge, and how Facebook runs the open source project.
What people said
Recommends Martin Konicek · 2018-03 · Stack Overflow · on “Is it worth it to use a thread for network requests in React Native?”
Network requests You can make requests from JavaScript as usual, using e.g. the fetch API [LINK] . Your network request won't block the UI. React Native will execute the network request using a background native (Java / Obj-C) thread. There is only one JavaScript thread where all your JS code runs, React Native doesn't have support for web workers. If you want to learn about the architecture of React Native you can watch this talk [this video] . Updating the UI Probably the easiest thing to do here would be to send fewer requests, less frequently. If you for absolutely have to send many requests, try to at least throttle the UI updates as you said. If that doesn't help you could also look at the
Recommends Martin Konicek · 2018-03 · Stack Overflow · on “Is it worth it to use a thread for network requests in React Native?”
There is one JavaScript thread (where all your JavaScript code runs) and multiple native (Java, Obj-C) threads which you normally don't have to worry about when writing JS code. You could watch this talk or read up on RN architecture: [this video]
Cites Morrison Chang · 2017-10 · Stack Overflow · on “React native increases size of apk file by 6.5 MB”
Proguard is only for Java classes not Javascript or any C/C++ binaries. And based on this YouTube video: [this video] it appears that React Native bundles its own JavaScript VM for Android in addition to other Java class files.
Cites akavel · 2018-06 · Stack Overflow · on “In the React Native codebase, where's the code generating the claimed "single JSON message"?”
Based on the articles linked in the question, as well as some [this video] videos [LINK] from 2015, after a day of digging in, I believe that it's indeed the BatchedBridge , a.k.a. MessageQueue , which is the bus for calling between Java/Swift and JS. If I understand correctly, a JS->Java call is done with MessageQueue.enqueueNativeCall [LINK] , defined as: enqueueNativeCall( moduleID: number, methodID: number, params: any[], onFail: ?Function, onSucc: ?Function, ) while a Java->JS call is done via any one of the following functions (in the same file): callFunctionReturnFlushedQueue(module: string, method: string, args: any[]) callFunctionReturnResultAndFlushedQueue(module: string, method: string