A Step-by-Step Setup Guide
React is one of the most popular JavaScript libraries for building modern, interactive user interfaces. Whether you’re a beginner or looking to polish your web development skills, this guide will walk you through setting up React and JSX using Visual Studio Code (VS Code). Along the way, we’ll explain the roles of key components like Node.js and npm, and provide references to trusted resources for further study.
What You Need
Before we dive in, make sure you have the following installed:
- Visual Studio Code (VS Code): Our primary code editor.
- Node.js and npm: Node.js lets you run JavaScript on your machine outside of a browser, and npm (Node Package Manager) helps you manage libraries and dependencies.
Step 1: Installing Node.js and npm
What is Node.js?
Node.js is an open-source runtime environment that lets you run JavaScript on the server-side or on your local machine. It’s crucial for modern web development as it supports the tools that help build and manage your web projects.
- Reference: For more details, visit the Node.js official website or check out MDN’s article on Node.js.
What is npm?
npm is the package manager for Node.js. It allows you to install, update, and manage packages (libraries) that your project depends on. When you use React, many of the libraries you’ll need are installed via npm.
- Reference: Learn more about npm on the npm documentation site.
Installing Node.js and npm
- Download Node.js:
- Visit Node.js and download the LTS (Long Term Support) version.
- Run the installer and follow the on-screen instructions.
- Verify Installation:
- Open your terminal (or the integrated terminal in VS Code).
- Run the following commands to ensure both Node.js and npm are installed:
node -v
npm -v
- You should see version numbers for both.
node -v npm -v
Step 2: Creating a New React Project with Vite

Traditionally, developers used Create React App (CRA) to bootstrap a React project. Now, many are turning to Vite, a faster and more streamlined build tool.
What is Vite?
Vite is a build tool that provides a fast development server and a highly optimized build process. Its simplicity makes it an excellent choice for starting React projects.
Creating a Project
- Open Visual Studio Code and Access the Terminal:
- In VS Code, navigate to View > Terminal to open the integrated terminal.
- Run the Vite Command:
- Execute the following command in the terminal to create a new React project:
npm create vite@latest my-react-app -- --template react
- This command creates a new folder named
my-react-app
pre-configured for React.
- Execute the following command in the terminal to create a new React project:
- Install Dependencies:
- Change into your project directory and install the necessary packages:
cd my-react-app npm install
- Change into your project directory and install the necessary packages:
- Start the Development Server:
- Launch the app by running:
npm run dev
- Your default web browser will automatically open, displaying the default React application.
- Launch the app by running:
- Reference: For an in-depth look at Vite, check out the Vite documentation.
Step 3: Understanding React and JSX
What is React?
React is a library for building dynamic user interfaces using a component-based architecture. This means your UI is made up of independent, reusable components that manage their own state and structure.
- Reference: The official React documentation is an excellent resource to deepen your understanding.
What is JSX?
JSX stands for JavaScript XML. It’s a syntax extension that allows you to write HTML-like code within JavaScript. JSX makes it easier to visualize and create the structure of your UI, and it gets transpiled (converted) into standard JavaScript at build time.
For example, instead of writing:
React.createElement('h1', null, 'Hello, world!');
You write:
<h1>Hello, world!</h1>
This code is much easier to read and write, especially as your components grow more complex.
Step 4: Creating a Simple React Component

Let’s create a basic React component as a practice exercise.
- Open the
App.jsx
File:- In your project folder (
my-react-app
), open thesrc/App.jsx
file.
- In your project folder (
- Modify
App.jsx
to Render a Welcome Message:
// src/App.jsx import React from 'react'; import './App.css'; function App() { return ( <div className="App"> <h1>Welcome to My React App!</h1> <p>This is a simple application to help you get started with React and JSX using Visual Studio Code.</p> </div> ); } export default App;
3. Save Your Changes:
- The development server should auto-refresh your browser, displaying your changes immediately.
Step 5: Exploring Your Development Environment
Visual Studio Code
- Editor and Integrated Terminal: VS Code is more than just a text editor. Its integrated terminal lets you run commands without leaving your editor.
- Extensions: Enhance VS Code with extensions like ESLint for code quality, Prettier for automatic formatting, and React-specific snippets for faster development.
- Debugging Tools: VS Code’s debugging capabilities allow you to set breakpoints and inspect variables, which is incredibly useful when developing complex applications.
- Reference: For more on mastering VS Code, consider exploring the VS Code documentation.
Final Thoughts
By following these steps, you’ve set up a React development environment using Visual Studio Code, Node.js, npm, and Vite. You’ve also learned the basics of React and JSX, which are essential for building dynamic web applications. Remember to explore the provided references and Codecademy’s Learn React course to expand your understanding further.
Your next steps may include building more complex components, managing state, and eventually deploying your application. Keep experimenting, and happy coding!
References: