How to Set Up Your React Development Environment

π§© Step 1: Install Node.js and npm
React uses Node.js and npm (Node Package Manager) to manage libraries and dependencies.
πΉ Check if Node.js is Installed
Open your terminal or command prompt and type:
node -v
npm -v
If you see version numbers, Node.js is already installed.
If not, download it from the official website:
π https://nodejs.org
πΉ Why You Need Node.js
It lets you run React tools like Vite or Create React App.
It includes
npm, which installs all required dependencies automatically.
βοΈ Step 2: Choose a React Setup Method
There are a few ways to set up a React project. Letβs look at the most popular ones π
π οΈ Option 1: Using Vite (Recommended)
Vite is a fast, modern tool for building React apps with a smooth developer experience.
π¦ Create a New Project
npm create vite@latest my-react-app
Then choose:
Framework: React
Variant: JavaScript or TypeScript
Move into your project folder:
cd my-react-app
Install dependencies:
npm install
Start the development server:
npm run dev
Now open your browser and visit the URL shown in the terminal β usually:
http://localhost:5173
π You now have a working React project with Vite!
π§° Option 2: Using Create React App (CRA)
Create React App is the classic setup tool thatβs beginner-friendly.
Run:
npx create-react-app my-react-app
After installation:
cd my-react-app
npm start
CRA automatically sets up Babel, Webpack, and other tools, so you can start coding immediately.
π¨ Step 3: Install VS Code (Code Editor)
To write React code efficiently, use Visual Studio Code β a lightweight and powerful code editor.
Download here:
π https://code.visualstudio.com
π§© Recommended VS Code Extensions:
ES7+ React/Redux/React-Native snippets β for fast React code templates
Prettier β for automatic code formatting
Tailwind CSS IntelliSense (if you use Tailwind)
Auto Import β helps manage imports automatically
π§± Step 4: Folder Structure Overview
A React app created with Vite or CRA looks like this:
my-react-app/
βββ node_modules/
βββ public/
βββ src/
β βββ App.jsx
β βββ index.js
β βββ components/
βββ package.json
βββ vite.config.js or webpack.config.js
Important Folders:
src/β where your React components and logic livepublic/β static files like images, icons, andindex.htmlpackage.jsonβ manages dependencies and project info
π» Step 5: Run and Edit Your App
After running npm run dev (or npm start in CRA), open:
http://localhost:5173
or
http://localhost:300
Edit App.jsx (or App.js) β save the file β and see instant changes in the browser.
Thatβs Hot Module Replacement (HMR) at work!
π§ Step 6: Install Additional Tools (Optional)
You can enhance your React environment with tools like:
React Developer Tools β Chrome/Firefox extension to inspect React components
Tailwind CSS β utility-first CSS framework for styling
Axios β for API requests
React Router β for navigation between pages
Example:
npm install react-router-dom axios



