Adam James

May 29, 2021

2 min read

React vs. React Native

Coming off of graduation from the Flatiron School, I was immediately looking for a way to keep up learning and build on the fundamentals we learned through the six months in bootcamp. The last month of Flatiron we spent learning React, the popular JavaScript library. On the prompting of one of my friends, I decided to learn how to develop mobile apps. After a bit of searching, I came across React Native, which is the mobile application framework developed by Facebook. As evident from the name, it’s a branch of the React framework, but it’s specifically used for mobile app development. Since they’re not quite the same exact frameworks, there are a few differences between the two.

At first glance, there is an immediate difference that should be obvious is the difference in JSX tags. While React JSX uses similar tags to JavaScript documents, but React Native uses different tags. The best examples of the differences are React’s <div> tag is used similarly to React Native’s <View> tag. React’s <p> or <h1> tags (or any tag that displays text) is used similarly to React Native’s <Text> tag. These tags are used primarily because they’re platform agnostic. React Native detects what platform is being used when the program is run and renders the correct code based off of that platform.

React Component Example
React Native Component Example

When going through styling for the two frameworks, React uses traditional CSS, but React Native uses stylesheets. Stylesheets are extremely similar to CSS, but are put inside each component instead of in a separate linked CSS file. The tags for styling are largely similar, but some tags have small differences from each other.

StyleSheet Example

React Native, very obviously, shares tons of similarities with React. I think one of the main questions is whether React Native is worth learning. If you want to learn a framework for mobile app development and you already know React, absolutely learn React Native, it’s only a couple steps away from being exactly the same. If you don’t know React and want to learn how to develop mobile apps, I’d start with learning React. It’ll be more useful to get the base framework under your belt, and you can always learn Native afterwards.