Professional Documents
Culture Documents
10/9/15, 11:45 AM
Page 1 of 7
React Native: Bringing modern web techniques to mobile | Engineering Blog | Facebook Code | Facebook
10/9/15, 11:45 AM
There are many reasons the native mobile environment is more dicult to work with
than the web. For one thing, it's harder to lay things out on the screen, and we often
have to manually compute the size and position of all our views. We also don't have
access to React or Relay, which have made it easier to scale the process of developing
websites and growing our engineering organization. One of the most painful things
about our transition to mobile, though, is how much it's slowed down our development
velocity.
When building on the web, we can simply save our files and reload the browser to see
the result of our changes. On native, however, we need to recompile after every change,
even if we just want to shift text a few pixels over on the screen. As a result, engineers
end up working a lot more slowly, especially in a large codebase where compilation is
especially burdensome. Building on native also makes testing new functionality more
dicult. At Facebook, we deliver a new version of the website twice a day, so we can
get the results of an experiment back almost immediately. On mobile, we often need to
wait weeks or months in order to get the results of an experiment or A/B test back,
because new versions of our app are released far less often. Move fast is in
Facebook's DNA, but we can't move as fast on mobile as we can on the web. So why
make the switch away from web in the first place?
The reason we build native apps on these proprietary platforms is that right now, we can
create better-feeling experiences that are more consistent with the rest of the platform
than we can on the web.
Page 2 of 7
React Native: Bringing modern web techniques to mobile | Engineering Blog | Facebook Code | Facebook
10/9/15, 11:45 AM
counterparts, and they also don't get updated automatically with changes to the
platform. We also don't have anything as sophisticated as the native mobile gesture
recognizers on the web, and we don't yet have the proper tooling or the developer
discipline needed to build a system that gets this right.
On the web, we also don't have a sophisticated threading model, so we can't parallelize
work onto multiple threads. We can try to make use of web workers to execute some of
our application logic in the background, but we can't yet perform highly numeric
computation like image decoding or text measurement eciently o the main thread in
the browser. This is probably one of the biggest challenges of building highperformance and responsive web apps.
Page 3 of 7
React Native: Bringing modern web techniques to mobile | Engineering Blog | Facebook Code | Facebook
10/9/15, 11:45 AM
Page 4 of 7
React Native: Bringing modern web techniques to mobile | Engineering Blog | Facebook Code | Facebook
10/9/15, 11:45 AM
thread boundary asynchronously and that we can batch up as many of these messages
per frame as possible, minimizing cross-thread communication overhead.
Luckily, React gives us the perfect programming model to do this correctly.
This is working
We've been using React Native in production at Facebook for some time now, and while
there's still a ton of work to do, it's been working really well for us. It's worth noting that
we're not chasing write once, run anywhere. Dierent platforms have dierent looks,
feels, and capabilities, and as such, we should still be developing discrete apps for
each platform, but the same set of engineers should be able to build applications for
https://code.facebook.com/posts/1014532261909640/react-native-bringing-modern-web-techniques-to-mobile/
Page 5 of 7
React Native: Bringing modern web techniques to mobile | Engineering Blog | Facebook Code | Facebook
10/9/15, 11:45 AM
whatever platform they choose, without needing to learn a fundamentally dierent set of
technologies for each. We call this approach learn once, write anywhere.
If you have an iPhone, you can test out a few apps using React Native that are available
from the App Store. Facebook Groups is a hybrid application, consisting of views built
both with native code and React Native JavaScript, and Facebook Ads Manager is built
entirely using React Native.
Open source
At Facebook, our mission is to make the world more open and connected, and we want
https://code.facebook.com/posts/1014532261909640/react-native-bringing-modern-web-techniques-to-mobile/
Page 6 of 7
React Native: Bringing modern web techniques to mobile | Engineering Blog | Facebook Code | Facebook
10/9/15, 11:45 AM
to actively contribute to that mission via open source. React Native is no exception. We
realize that the problems we face as an engineering organization are not unique to us,
and accordingly, we want to develop in the open as much as possible, collaborating
with others who are facing the same challenges.
Today, we're excited to open-source React Native for iOS and make it available on
GitHub. Android support is coming soon, and we're also continuing full steam ahead on
React for the web, but we wanted to get this initial iOS support out as early as possible
so we can get input from others who are also excited about this approach. Keep in mind
that there are probably many things that are either broken or not implemented yet. We
welcome your feedback and contributions, and we can't wait to see what you'll build!
https://code.facebook.com/posts/1014532261909640/react-native-bringing-modern-web-techniques-to-mobile/
Page 7 of 7