2016年,答案是根据这个问题“解释”的Does React Native compile JavaScript into Java for Android? 。然而,自 2022 年以来,React Native 引入了新的架构:
The New Architecture dropped the concept of The Bridge in favor of another communication mechanism: the JavaScript Interface (JSI). The JSI is an interface that allows a JavaScript object to hold a reference to a C++ and vice-versa. Once an object has a reference to the other one, it can directly invoke methods on it. So, for example, a C++ object can now ask a JavaScript object to execute a method in the JavaScript world and viceversa.
https://reactnative.dev/docs/the-new-architecture/why
据我了解,这仍然是一种解释方法。但我今天读到的一些文章和一篇硕士论文声称它是基于编译的,但没有明确解释这一说法。也许我的理解是错误的。那么 React Native 仍然是解释型的还是现在是编译型的?
最佳答案
React Native 仍然包含在 JS 解释器中执行的 Javascript 代码,由于新架构的变化,该解释器将被开放。
这是一篇简洁的文章,详细比较了新旧架构:https://medium.com/coox-tech/deep-dive-into-react-natives-new-architecture-fb67ae615ccd
关于javascript - React Native 仍然是解释型的还是基于编译的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76055585/