Step 1: Install Node.js
React requires Node.js and npm (Node Package Manager). If you haven’t installed Node.js:
Download Node.js:
- Visit Node.js Official Website.
- Download and install the LTS (Long Term Support) version.
Verify Installation:
- Open a terminal or Command Prompt.
- Run
node -v
npm -v
You should see the versions of Node.js and npm.
Step 2: Create a New React Project
Using Create React App (CRA):
- Open a terminal or Command Prompt.
- Navigate to the folder where you want to create the React project:
Run
npx create-react-app my-first-react-app
This will create a new React project named my-first-react-app.
Navigate to the Project Folder:
cd my-first-react-app
Step 3: Open Project in Visual Studio
Open Visual Studio:
Launch Visual Studio from the Start menu.
File → Open → Folder.