Create new react native app

Here's a step-by-step guide to create a new React Native app:

Prerequisites:

Step 1: Create a new React Native project

Open your terminal and run the following command to create a new React Native project:

npx react-native init <projectName>

Replace <projectName> with the name of your app (e.g. "MyApp").

Step 2: Navigate to the project directory

Change into the project directory:

cd <projectName>

Step 3: Install dependencies

Run the following command to install the dependencies required by React Native:

yarn install

Step 4: Start the packager

Run the following command to start the packager, which will allow you to run your app on a simulator or physical device:

yarn start

Step 5: Open the app in a simulator or physical device

Open the app in a simulator or physical device by running the following command:

npx react-native run-ios

or

npx react-native run-android

depending on the platform you want to run the app on.

Step 6: Create a new component

Create a new file called App.js in the src directory:

touch src/App.js

Add the following code to App.js:

import React from 'react';
import { View, Text } from 'react-native';

const App = () => {
  return (
    <View>
      <Text>Hello, World!</Text>
    </View>
  );
};

export default App;

This code defines a simple React Native component that displays a "Hello, World!" message.

Step 7: Update the app component

Update the App.js file to use the new component:

import React from 'react';
import { AppRegistry } from 'react-native';
import App from './App';

AppRegistry.registerComponent('App', () => App);

Step 8: Run the app again

Run the app again by running the following command:

npx react-native run-ios

or

npx react-native run-android

depending on the platform you want to run the app on.

That's it! You now have a new React Native app up and running. You can start building your app by adding more components, styling, and functionality.