beginner
frontend

Setting Up Your Environment

Installing Node.js, npm, and creating your first React app

react fundamentals
15 min read

Setting Up Your Development Environment

Before you can start building with React, you need to set up your development environment. This lesson will guide you through installing the necessary tools.

Installing Node.js and npm

Node.js is a JavaScript runtime that allows you to run JavaScript outside the browser. npm (Node Package Manager) comes bundled with Node.js and is used to install and manage packages.

Step 1: Download Node.js

Visit nodejs.org and download the LTS (Long Term Support) version for your operating system.

  1. Download the Windows Installer (.msi) from nodejs.org
  2. Run the installer and follow the installation wizard
  3. Verify installation by opening Command Prompt and running:

node --version


npm --version

Creating Your First React App

Now that you have Node.js and npm installed, you can create your first React application using Create React App or Vite.

Vite is the modern, faster alternative to Create React App:

bash
npm create vite@latest my-react-app -- --template react cd my-react-app npm install npm run dev

Success!

Your React app should now be running at http://localhost:5173. Open it in your browser to see your first React application!

Using Create React App (Alternative)

bash
npx create-react-app my-react-app cd my-react-app npm start

Understanding the Project Structure

After creating your app, you'll see this folder structure:

my-react-app/
├── node_modules/
├── public/
│   └── index.html
├── src/
│   ├── App.jsx
│   ├── App.css
│   ├── main.jsx
│   └── index.css
├── package.json
└── vite.config.js

Key Files Explained

src/main.jsx
Entry point of your application
src/App.jsx
Main React component
package.json
Project dependencies and scripts
vite.config.js
Vite configuration file

Video Tutorial

Next Steps

Continue Learning
With your development environment set up, you're ready to learn about JSX syntax and start writing React components!

Next Lesson

JSX Syntax