Earlier in the year, Facebook made their React Native framework open-source for iOS to ensure developers can build applications using modern web techniques without having to battle with their existing frameworks. Zuckerberg’s social giant has now taken the steps for Android developers, which has allowed them to speed-up the process of building sophisticated native applications.
React Native started as an internal tool built to make Facebook’s developers more productive, and to offer a more efficient alternative to MVC (Model View Controller) frameworks, client-side templating systems, server-side rendering, and Facebook’s own XHP.
In a blog post announcing React for iOS, Tom Occhino from Facebook explained: “React forces us to break our applications down into discrete components, each representing a single view. These components make it easier to iterate on our products, since we don’t need to keep the entire system in our head in order to make changes to one part of it. More important, though, React wraps the DOM’s mutative, imperative API with a declarative one, which raises the level of abstraction and simplifies the programming model.”
He continued: “What we’ve found is that when we build with React, our code is a lot more predictable. This predictability makes it so we can iterate more quickly with confidence, and our applications are a lot more reliable as a result. Additionally, it’s not only easier to scale our applications when they’re built with React, but we’ve found it’s also easier to scale the size of our teams themselves.”
React was built from experience, and developed over the past year for mobile through solving first-hand issues that Facebook’s iOS engineers came across. The first cross-platform app Facebook developed using React Native was Ads Manager, and features were added to React based-on what the developers felt were missing.
When it came to porting Ads Manager to Android from iOS, the engineers told the packager to ignore all files ending in .ios.js which avoided having code for iOS in there. Despite this, around 85% of the code was found to be reusable, and little needed changing apart from a few platform-specific components and styling.
To get started with React Native for Android, head to GitHub here.
What do you think about Facebook’s React Native framework? Let us know in the comments.