How to start a new react native project
To start a new React Native project, you can follow these steps:
Method 1: Using the React Native CLI
-
Install the React Native CLI by running the following command in your terminal:
npm install -g react-native-cli
-
Create a new project by running the following command:
npx react-native init <projectName>
Replace
<projectName>
with the name of your project. -
Follow the prompts to choose the project template and configuration options.
Method 2: Using Expo
-
Install Expo by running the following command:
npm install -g expo-cli
-
Create a new project by running the following command:
expo init <projectName>
Replace
<projectName>
with the name of your project. -
Follow the prompts to choose the project template and configuration options.
Method 3: Using a code editor or IDE
-
Open your preferred code editor or IDE (e.g. Visual Studio Code, IntelliJ IDEA, etc.).
-
Create a new directory for your project and navigate into it.
-
Run the following command to create a new React Native project:
npx react-native init <projectName>
Replace
<projectName>
with the name of your project. -
Follow the prompts to choose the project template and configuration options.
Common configuration options
When creating a new React Native project, you'll be prompted to choose the following configuration options:
- Template: Choose from a variety of templates, such as a blank project, a project with a navigation component, or a project with a login screen.
- Language: Choose the programming language you want to use for your project (e.g. JavaScript, TypeScript).
- Platform: Choose the platforms you want to support (e.g. iOS, Android, both).
- Version: Choose the version of React Native you want to use.
Next steps
Once you've created your new React Native project, you can start building your app by:
- Running the app on a simulator or physical device using
npx react-native run-ios
ornpx react-native run-android
. - Exploring the project structure and files in your code editor or IDE.
- Starting to write your app's code using React Native components and APIs.