React Native at Airbnb: The Technology

The technical details

Gabriel Peal
16 min readadvanced
--
View Original

Overview

The article discusses Airbnb's experience with React Native, detailing both the advantages and challenges faced while implementing the technology. It highlights key technical insights, performance considerations, and the importance of infrastructure investment to ensure a successful integration of React Native into their mobile applications.

What You'll Learn

1

How to achieve 95-100% shared code between Android and iOS using React Native

2

Why investing in infrastructure is crucial for a successful React Native implementation

3

How to effectively manage performance issues in React Native applications

4

When to utilize Redux for state management in React Native projects

Key Questions Answered

What are the main benefits of using React Native at Airbnb?
The main benefits of using React Native at Airbnb include achieving 95-100% shared code between Android and iOS, enabling rapid iteration speeds through features like hot reloading, and leveraging a unified design language system that maintains consistency across platforms. These advantages contribute to a more efficient development process and improved user experience.
What challenges did Airbnb face while using React Native?
Airbnb faced several challenges with React Native, including its immaturity compared to native platforms, the need to maintain a fork of React Native due to necessary patches, and difficulties with JavaScript tooling that complicated scaling and refactoring. These issues often led to unexpected bugs and increased development time.
How does Airbnb manage performance in their React Native applications?
Airbnb manages performance in their React Native applications by offloading business logic and layout calculations from the main thread, effectively using shouldComponentUpdate and removeClippedSubviews to reduce excessive rendering. They also monitor render times and prioritize performance optimization based on analytics.
What is the impact of React Native on app size at Airbnb?
The use of React Native has a significant impact on app size, with the total size being approximately 8MB per ABI on Android. This includes Java, JavaScript, native libraries like Yoga, and the JavaScript runtime, leading to an overall increase in the APK size, which can reach up to 12MB when including both x86 and arm architectures.

Key Statistics & Figures

Initial render time on iOS
280ms
This is the average time taken for the first render of a React Native screen on iOS.
Initial render time on Android
440ms
This is the average time taken for the first render of a React Native screen on Android.
Shared code percentage
95-100%
This percentage represents the amount of code that can be shared between Android and iOS applications using React Native.
App size impact on Android
8MB per ABI
This is the total size of React Native components, including Java, JavaScript, and native libraries.

Technologies & Tools

Some links below are affiliate links. We may earn a commission if you make a purchase.

Frontend
React Native
Used for building cross-platform mobile applications at Airbnb.
State Management
Redux
Utilized for managing application state in React Native applications.
Runtime
Javascriptcore
JavaScript execution environment used in React Native.
Layout Engine
Yoga
Used for handling layout calculations in React Native applications.

Key Actionable Insights

1
Investing in a robust infrastructure is essential for React Native success. This includes wrapping existing native APIs into a consistent React Native API to streamline development and maintain performance.
Without a strong infrastructure, developers may face significant challenges, leading to a subpar user experience and increased development time.
2
Utilizing Redux for state management can help keep the UI in sync with the application state, but it requires careful implementation to avoid boilerplate and complexity.
While Redux is effective, it has a steep learning curve, and developers should consider providing templates or generators to ease the onboarding process.
3
Regularly monitor performance metrics to identify bottlenecks in React Native applications. Use tools to analyze render times and prioritize optimization efforts accordingly.
By focusing on performance metrics, teams can ensure that their applications remain fluid and responsive, enhancing the overall user experience.

Common Pitfalls

1
One common pitfall is the immaturity of React Native, which can lead to unexpected challenges and bugs that are difficult to predict.
This immaturity can result in trivial tasks taking significantly longer than expected, making it crucial for teams to be prepared for potential setbacks.
2
Maintaining a fork of React Native can complicate upgrades and increase the workload for developers.
This situation arises when necessary patches are not available in the main React Native repository, leading to a fragmented experience and potential issues during version upgrades.
3
JavaScript's lack of type safety can make refactoring error-prone and difficult.
Developers coming from typed languages may struggle with the untyped nature of JavaScript, leading to bugs that only manifest at runtime rather than compile time.

Related Concepts

Cross-platform Mobile Development
State Management In React Applications
Performance Optimization Techniques In Mobile Apps