Skip to content

ReactJS Environment Setup

πŸ› οΈ ReactJS Environment Setup


🎯 Objective:

To set up a ReactJS development environment so you can build, run, and test React applications on your local system.


βœ… Step 1: Prerequisites

Before installing React, you need the following software installed:

πŸ”Ή 1. Node.js

  • React uses Node.js for running scripts and installing packages using npm (Node Package Manager).
  • It also includes npm, which is required to install React packages.

πŸ”§ Install Node.js:

  • Visit: https://nodejs.org/
  • Download LTS version (Long Term Support).
  • Install using the wizard.

πŸ” Check Installation:

node -v   # Shows Node.js version
npm -v # Shows npm version

βœ… Step 2: Install Create React App

Create React App is a tool that sets up a new React project with a ready-to-use development environment.

πŸ“₯ Install it (one-time globally):

npm install -g create-react-app

βœ… This command installs a global utility to quickly scaffold new React projects.


βœ… Step 3: Create a New React Project

Now, let’s create a React app called myapp.

npx create-react-app myapp

πŸ”Ή This command:

  • Sets up the project structure
  • Installs all required dependencies
  • Adds React boilerplate code

βœ… npx (comes with npm) ensures you’re using the latest version of create-react-app without installing it globally.


βœ… Step 4: Navigate to Project Directory

cd myapp

This is now your project root folder, where all React files reside.


βœ… Step 5: Start the Development Server

To start the app:

npm start

πŸŽ‰ This will:

  • Compile the code
  • Open your app in the browser (usually at http://localhost:3000)
  • Show a default React welcome page

βœ… React Folder Structure Overview

myapp/
β”œβ”€β”€ public/
β”‚ └── index.html # Single root HTML page
β”‚
β”œβ”€β”€ src/
β”‚ β”œβ”€β”€ App.js # Main App Component
β”‚ β”œβ”€β”€ index.js # Renders App component to DOM
β”‚ └── components/ # (You create this folder for reusable components)
β”‚
β”œβ”€β”€ package.json # Project configuration and dependencies
β”œβ”€β”€ node_modules/ # All installed libraries

πŸ“¦ package.json – React App Configuration

This file stores:

  • Project name and version
  • Installed dependencies (React, React DOM)
  • Scripts like start, build, and test

πŸ”§ Important Commands:

CommandPurpose
npm startRun development server
npm run buildPrepare production build
npm testRun tests (if written)
npm install <pkg>Install new packages (like Bootstrap, Axios)

πŸ§ͺ Optional Tools to Enhance Workflow

ToolPurpose
VS CodeRecommended code editor
React Developer Tools (Chrome/Firefox)Inspect components in browser
GitVersion control (for teamwork)
PostmanTest APIs (for React-API apps)

βœ… Recap of Setup Steps

StepAction
1️⃣Install Node.js + npm
2️⃣Use npx create-react-app myapp
3️⃣Navigate to project folder
4️⃣Run npm start to launch dev server
5️⃣Build components and start coding!

πŸ”° Additional Tips for MCA Students

  • Always create reusable components (Header, Footer, etc.).
  • Practice passing props and managing state.
  • Learn React Router for building multipage apps.
  • Explore Hooks (useState, useEffect) for functional components.
  • Use Bootstrap or Material UI for designing UI quickly.