Getting Started with React
Learn what you need before starting React development, how to create a React project, and how to run your first application.
1. Introduction to React Getting Started
Before developing a React application, we need to prepare our development environment. This includes installing the required tools, creating a project, understanding its folder structure, and running the application in a browser.
In this module, we will use React to build the user interface and Vite to create and run the development project.
2. What Do You Need to Start React?
JavaScript
React uses JavaScript to define components, work with data, handle events, and create dynamic UIs.
Programming LanguageNode.js
Node.js provides a JavaScript runtime used by development tools and many React project commands.
JavaScript Runtimenpm
npm helps install and manage the packages required by a React project.
Package ManagerCode Editor
Visual Studio Code or another code editor helps you create, edit, and organize project files.
Development Tool3. React Development Setup Flow
Follow these steps in sequence to get your first React development environment ready.
Install Node.js
Install Node.js and npm on your computer.
Create a React Project
Use Vite to generate a React project.
Install Dependencies
Install the packages required by the project.
Run the Application
Start the development server and open the app.
React App Running
Your application is ready to view in the browser.
4. Understanding the Tools
| Tool | Purpose | Example |
|---|---|---|
| React | Builds user interfaces using components. | Course cards, forms and navigation. |
| Node.js | Runs JavaScript outside the browser and supports development tools. | Running project tooling. |
| npm | Installs and manages project dependencies. | npm install |
| Vite | Creates the project template and provides a development server. | npm run dev |
| VS Code | Used to edit and manage source files. | Editing App.jsx. |
5. Basic Commands You Will Use
After Node.js is installed, open Command Prompt or the VS Code terminal and run the following commands to check your environment.
Check Node.js Version
node --version
This command displays the installed Node.js version.
Check npm Version
npm --version
This command displays the installed npm version.
Expected Output
v22.x.x
10.x.x
These are example version formats only. Your actual version numbers may be different.
6. Preview: Creating a React Project
In the upcoming lessons, we will create a project using Vite. The following commands show the overall process.
npm create vite@latest my-react-app -- --template react
cd my-react-app
npm install
npm run dev
npm create vite@latest
Starts the Vite project creation tool.
cd my-react-app
Moves into the newly created project folder.
npm install
Installs the project's required packages.
npm run dev
Starts the development server using the project's script.
Expected Result
The terminal displays a local development URL, commonly:
Open the URL shown in your own terminal. The port can differ if the default port is already in use.
We will explore these commands step by step in the next lessons.
7. What Will You Learn in This Module?
Getting Started Introduction
Understand the React setup process.
Prerequisites
Learn what is required before installing React tools.
Installing Node.js and npm
Install and verify the development environment.
Creating a React Project with Vite
Generate a React project from the terminal.
React Project Structure
Understand important folders and files.
Running React Application
Start the development server and open the app.
Your First React Application
Build and understand your first working component.
Summary
- React is used to build component-based user interfaces.
- Node.js and npm support the React development workflow.
- Vite helps create and run a React project.
- A code editor helps you write and manage source files.
- The development server lets you view your application in a browser.
- The following lessons will explain each setup step in detail.