Steps to create a React Native Application

Step 1: Open your terminal and install expo-cli by the following command.

npm install -g expo-cli

Step 2: Now create a project by the following command.

expo init react-native-demo

Step 3: Now go into your project folder i.e. react-native-demo

cd react-native-demo

Project Structure:

App.js




import React from "react";
import { StyleSheet, Text, View } from "react-native";
 
export default function App() {
  return (
    <View style={styles.container}>
      <Text style={styles.header}>React Native Demo Application</Text>
    </View>
  );
}
 
const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#fff",
    alignItems: "center",
    justifyContent: "center",
  },
  header: {
    color: "#006600",
    fontSize: 22,
    fontWeight: "700",
  },
});


Step to Run  Application: Start the server by using the following command.

expo start

Output:

How React Native is different from ReactJS ?

In this article, we will learn about how React Native is different from ReactJS. ReactJS and React Native are both popular JavaScript libraries, ReactJS is primarily used for building user interfaces on the web, while React Native extends the capabilities to mobile app development.

Table of Content

  • React JS
  • React Native
  • Differences between React and React Native

Similar Reads

React JS:

It is a JavaScript library that supports both front-end and server-side. It is a popularly used library, which focuses on developing user interfaces (UI) for mobile as well as web-based applications. Developed by Facebook, it is based on the JavaScript language and hence, it is synonymously also called ReactJS....

Steps to Create a React Application:

Step 1: Create a React application using the following command:...

React Native:

...

Steps to create a React Native Application:

React Native is a cross-platform mobile framework that uses the ReactJS framework. As the name suggests, it is primarily used for developing “native” mobile applications (like Windows, iOS as well as Android). Also developed by Facebook, the major advantage provided by React Native is that it allows the developers to create mobile applications on various different platforms without compromising the end user’s experience....

Differences between React and React Native:

Step 1: Open your terminal and install expo-cli by the following command....