React Native recently announced the release of 0.68.0, with an opt-in to new architecture and some bug fixes. In this blog, we will briefly see some of the changes in React Native 0.68.0.
Architecture Upgrade
This will be the first version of React Native with opt-in support for Fabric Renderer and the TurboModule system. The fabric renderer will improve the communication between React Native and the host platforms like Android, iOS, macOS, etc.
In previous versions of React Native, on running the application, JavaScript code was bundled into a package called JS Bundle. The JS thread was responsible for running this code. Whereas the native code was kept separate, and the native/UI thread was responsible for running it. Bridges were used for communication between the JS thread and the native thread using serialized JSON.
With the new renderer, there is an improvement in performance. The renderer is implemented in C++ and the core is shared among platforms. This improves consistency and easier to adopt React Native on new platforms. The transfer of data is improved by accessing JavaScript values directly using JavaScript Interfaces (JSI). Host components are now lazily initialized by default making it faster during startup.
With the new renderer, React Native uses a Render-Commit-Mount
strategy to render React logic to a host platform.
Some breaking changes and version bumps
- React Native has been updated to node 16 (latest LTS).
- Android Gradle Plugin updated to 7.0.1.
- @react-native-community/cli to 7.0.3
- Flipper to 0.125.0
- react-native-codegen to 0.0.9
- Kotlin to 1.6.10
- Soloader to 0.10.3
- Metro to 0.67
- react-devtools-core dependency to 4.23.0
- Android compile and target SDK to 31
Website upgradations
There have been quite a few improvements to the React Native website. Contributing and Architecture sections have been added to the main toolbar making it more easily accessible. Also, these sections are now unversioned.
With the modifications in the core architecture, this looks like a promising upgrade for React Native and will improve the application performance drastically. Refer to this article for more information about the upgrade.