React Native – Hello World

Step 1

cd Desktop/
npx react-native init helloWorldApp 

Run your AVD Emulator from Android Studio and close Android Studio. Keep emulator running

Step 2

Go to folder created

cd helloWorldApp 

Step 3

Running React Native application

npx react-native start 

Step 4

Run Packager – Android simulator – use different terminal

Step 5

npx react-native run-android 

This will take few minutes to execute

Open editor >> Visual Studio Code.app

In App.js add below code

import React, {Component} from 'react';  
import {Platform, StyleSheet, Text, View} from 'react-native';  
  
type con = {};  
export default class App extends Component<con> {  
  render() {  
    return (  
      <View style={styles.container}> 
        <Text style={styles.setFontSize}>Hello World</Text>  
      </View>  
    );  
  }  
}  

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center'
  },
  setFontSize: {
    fontSize: 40 // Define font size here in Pixels
  }});