Blog Technology

Part 1- What is React Native?

In this article, we’re going to learn a brief overview of what React Native is. React Native is a UI framework that lets you use JavaScript and React to build a native mobile app. That’s right, you use JavaScript and React to build up a native mobile app.

React Native was open-sourced by Facebook in 2015, and ever since then, this framework has gained a lot of popularity. Now that you have a rough idea of what React Native is, this is a good time to learn about the prerequisites to becoming a React Native developer.

Prerequisites: 

JavaScript

First things first, you will have to learn JavaScript. If you’re already a JavaScript developer, then you’re in good shape. If not, you will have to learn JavaScript, and It is highly recommended to learn the latest standards of JavaScript which React Native support. 

React

The next thing that you’ll have to learn is React. React is the popular web framework out there, and React Native is built using both JavaScript and React.

JSX

You’ll have to familiarize yourself with JSX. JSX stands for javascript expressions and it gives the concept of React before you dive into React Native. 

Learning JSX is quite simple. Just like XML, it has a tag name, attributes, children, and so on. But, you still need to learn some of it before you jump into React Native. Finally, you need to start thinking like a mobile developer.

Let’s take a look at the example code here. You can see it is written entirely in JavaScript, and we have a class that extends a React component. We also have a render method that returns some JSX. For React developers out there, you may be thinking, hey, this looks very familiar. React Native uses the react library, and the code samples look very similar. The only difference you may spot here is that there are no divs, there are no spans. Instead, you have different types of components called Text and View. 

Styling in React Native

Since React Native is a UI framework, styling plays a very important role in React Native. 

You can notice in this example, here we are calling a component called Stylesheet that comes out of the box to create styles. React Native does not use any CSS or any special language. Instead, you can do all your styling using plain JavaScript. The style names and values match CSS, and they may have some subtle differences. Also, notice that everything here is defined in CamelCase. For layout options, React Native uses flexbox, and every component can have its corresponding stylesheet in React Native. Depending on your platform, whether it’s an iOS or Android device, sometimes you may need some custom styling, and React Native provides platform-specific styling for those situations. 

Summary

We have learned about what is react native and why react native is so popular. React native is a technology that provides a way to build mobile apps using Javascript and React, which are native. 

In our next article Is React Native right for your business?, we will talk discuss if React Native is right for your business or not.

.

Author

AlliedConsultants