codingstuff.io
ExploreTutorialsProblemsCS Subjects
Get Started
ExploreTutorialsProblemsCS Subjects
Get Started
codingstuff.io

Master the art of building software through interactive tutorials, real-world problems, and guided projects.

Pune, Maharashtra, India

codingstuffmail@gmail.com

Product

  • Explore
  • Tutorials
  • Problems
  • CS Subjects

Company

  • About
  • Contact
  • Privacy Policy
  • Terms & Conditions
  • Sitemap

© 2026 codingstuff.io. All rights reserved.

Built with ❤️ for developers everywhere

/
/
All Tutorials
⚛️

React.js

2 / 61 topics
1Introduction to React.js2Setting Up Your Development Environment3JSX: Basics and Syntax4Components Introduction5Functional Components6Class Components7Props: Introduction and Usage8State: Introduction and Usage9Event Handling in React
Tutorials/React.js/Setting Up Your Development Environment
⚛️React.js

Setting Up Your Development Environment

Updated 2026-04-20
4 min read

Introduction

Before diving into building applications with React.js, it's crucial to set up a robust development environment. This setup will ensure that you have all the necessary tools and configurations to develop, test, and debug your React applications efficiently. In this tutorial, we'll walk through the steps to set up your development environment for React.js.

Prerequisites

Before proceeding with the setup, make sure you have the following prerequisites installed on your system:

  • Node.js: React requires Node.js to run. You can download it from nodejs.org. It's recommended to use the LTS version.
  • npm (Node Package Manager): This comes bundled with Node.js, so if you have Node.js installed, you should already have npm.

Step 1: Install Node.js and npm

  1. Download Node.js: Go to nodejs.org and download the LTS version for your operating system.
  2. Install Node.js: Follow the installation instructions specific to your OS. During installation, make sure to check the option that says "Add to PATH" (on Windows) or add the bin directory to your PATH manually (on macOS/Linux).
  3. Verify Installation:
    • Open a terminal or command prompt.
    • Run the following commands to verify the installations:
node --version
npm --version

You should see version numbers for both Node.js and npm.

Step 2: Set Up Your First React Application

Now that you have Node.js and npm set up, let's create your first React application using Vite, which is a modern build tool that offers faster builds and better developer experience.

  1. Create a New React App with Vite:
npm create vite@latest my-first-react-app --template react

This command creates a new directory called my-first-react-app with all the necessary files and configurations for a basic React application using Vite.

  1. Navigate to Your Project Directory:
cd my-first-react-app
  1. Install Dependencies:
npm install
  1. Start the Development Server:
npm run dev

This command starts the development server and opens your new React app in the default web browser. You should see a welcome message indicating that the app is running.

Step 3: Install Additional Tools (Optional but Recommended)

Depending on your needs, you might want to install additional tools to enhance your development experience.

a. Code Editor

A good code editor is essential for efficient coding. Popular choices include:

  • Visual Studio Code: Highly recommended due to its extensive support for React and other technologies.
  • Atom: Another great option with a wide range of plugins.

Install the following extensions in Visual Studio Code (or equivalent plugins in other editors):

  • ESLint: For linting JavaScript code.
  • Prettier: For formatting code.
  • React Developer Tools: For debugging React applications.

b. Version Control System

Version control is crucial for managing changes to your codebase. Git is the most popular version control system, and GitHub or GitLab are common platforms for hosting repositories.

  1. Install Git:

    • Download from git-scm.com.
    • Follow the installation instructions specific to your OS.
    • Verify installation by running git --version in your terminal.
  2. Initialize a Git Repository:

git init
  1. Create a GitHub/GitLab Repository and Connect It Locally:
  • Create a new repository on GitHub or GitLab.
  • Add the remote URL to your local repository:
git remote add origin https://github.com/yourusername/my-first-react-app.git

Step 4: Configure ESLint and Prettier

ESLint helps you identify and fix problems in your JavaScript code, while Prettier ensures consistent formatting. Here's how to set them up together:

  1. Install ESLint and Prettier:
npm install eslint prettier --save-dev
  1. Initialize ESLint:
npx eslint --init

Follow the prompts to configure ESLint according to your preferences.

  1. Create a .prettierrc file in the root of your project with the following content:
{
  "semi": true,
  "singleQuote": true,
  "trailingComma": "all"
}
  1. Configure ESLint to work with Prettier: Add the following to your .eslintrc.json file:
{
  "extends": ["react-app", "plugin:prettier/recommended"],
  "rules": {
    "prettier/prettier": "error"
  }
}
  1. Install ESLint and Prettier extensions in your code editor to integrate them with the IDE.

Step 5: Test Your Setup

To ensure everything is set up correctly, let's make a small change in your React application:

  1. Edit src/App.jsx:
import React from 'react';
import './App.css';

function App() {
  return (
    <div className="App">
      <header className="App-header">
        <h1>Welcome to My First React App</h1>
        <p>This is a simple React application.</p>
      </header>
    </div>
  );
}

export default App;
  1. Save the file and check your browser. You should see the updated message.

Conclusion

You have now successfully set up your development environment for React.js using Vite. With Node.js, npm, a code editor, version control, ESLint, and Prettier configured, you're ready to start building complex and efficient React applications. Remember to keep your tools and libraries up to date to benefit from the latest features and security patches.

Additional Resources

  • React Documentation
  • Vite Official Website
  • ESLint Official Website
  • Prettier Official Website

By following this comprehensive guide, you should have a solid foundation for developing React applications. Happy coding!


PreviousIntroduction to React.jsNext JSX: Basics and Syntax

Recommended Gear

Introduction to React.jsJSX: Basics and Syntax