React (Not So) Native
Starting my career as a developer, the first language I dove in was Javascript. JS is user friendly and I realized that from the beginning. Later on, I was introduced to React.js. React.js is a JS library created by Facebook and is used for building web user interfaces through a Single Page Architecture, meaning the website is composed by only one html file. It is maintained by the Facebook Developer community and other individuals. With React, you are able to build a hierarchy of components (views) and render them in your browser. It provides support for frontend development as well as some backend handling (with a little bit of help).
Enter React Native.
RN is a Javascript framework for writing mobile applications for iOS and Android. It is based on React, but it targets mobile platforms. It uses the same architecture but I quickly discovered it has some key differences. In a few words, web developers can now enter the world of mobile applications simply by learning a few new concepts like navigation stacks and touch events, by still using good ol’ React. Sounds promising? That’s because it is!. Right before I started using React Native, I thought it would be a tough learning curve to overcome. It ended up being quite the opposite.
React is a very powerful framework because it provides a bunch of advantages:
* The debugging process becomes easier. Logs and dev tools are at your full disposal to make as few refreshes as possible to get your desired outcome.
* The Document Object Model (DOM) defines the logical structure of documents and the way a document is accessed and manipulated. By using React, the virtual DOM is faster than the full refresh model. That happens because React refreshes, renders and manipulates certain parts of the page as needed. Our life as developers, becomes easier and we get to see our code deploy much faster.
* React, is a very small API with just a few functions and a very standard structure to use. That makes it simple to work with, and without spending time to have to read the whole documentation at once. Only the parts you are currently working on.
As for React Native; See all of the above.
Everything mentioned above is almost the same with the exception of not having a DOM. We still have a context of a global Document though but it’s not really needed in the mobile context.
React Natives components allow you to quickly build applications, by simply using the framework and adjusting your web-development skills. And you only need to build it once for both iOS and Android! React Native is designed to convert your JS components to native UI components for the two different platforms. And while React uses HTML and CSS which we can’t use in React Native, the framework is nice enough to provide us with built in tools to design our views the way we want them to act.
The advantages in using React and React Native over the standard approaches for web and mobile are numerous. The differences are laying on what a developer wants to accomplish. As I mentioned, React renders the DOM when React Native uses Native API’s to render components on the phones. But if your will pulls you towards the latest mobile trend, you can easily hop on the React Native train with even the most basic React Knowledge.
In retrospect, if you have a well set foundation in React and know your ins and outs of the architecture, it is really a matter of what you want to work on next. The mobile world becomes much less intimidating that what I thought it to be when I first started considering writing my first project in it.