Key takeaways:
Hermes is a JavaScript engine optimized for React Native, bundled from version 0.70.
It uses Ahead-of-Time (AOT) compilation, reducing runtime bytecode conversion.
Improves app start time, reduces memory usage, and shrinks binary size using tree-shaking and minification.
For React Native version ≥ 0.70, Hermes is enabled by default; older apps need upgrades.
Android: Enable hermesEnabled=true
in android/gradle.properties
, clean the build, and rebuild the app.
iOS: Set :hermes_enabled => true
in ios/Podfile
, install dependencies, and rebuild the app.
Confirm Hermes with !!global.HermesInternal
in the app's code.
Debug Android apps using Chrome DevTools at chrome://inspect#devices
.
iOS apps require debugging configurations via Xcode or Chrome extensions.
Hermes is a an open-source JavaScript engine which is used for optimizing React Native apps. From React Native 0.70 onwards, Hermes is bundled with React Native—this distribution model is called bundled Hermes.
Before Hermes, React Native apps were read in bytecodes at runtime. This meant that the same code when run 100 times would be converted into bytecode before compilation. Hermes removes this redundancy in compilation by using an ahead-of-time compiler, which runs the code beforehand and optimizes it before runtime. Thus, the code can be efficiently mapped to memory at runtime, thus saving the start time of the app and the memory needed to store it during runtime.
Babel: A JavaScript compiler that converts modern JavaScript code into backwards-compatible versions for older browsers.
Minify: The process of removing unnecessary characters from code (like spaces and comments) to reduce its size and improve performance.