
ReactJS is one of the most popular JavaScript libraries for building user interfaces. If you’re new to React, a great way to start is by creating a simple “Hello, World!” application. This guide will walk you through the process step-by-step.
What is ReactJS?
ReactJS, commonly referred to as React, is a JavaScript library developed by Facebook. It is used to build fast and interactive user interfaces. React is component-based, which means your UI is divided into small, reusable pieces called components.
Setting Up Your Environment
To get started with React, you’ll need:
- Node.js and npm:
- Download and install Node.js from nodejs.org. npm (Node Package Manager) comes bundled with Node.js.
- A Code Editor:
- Use a code editor like Visual Studio Code for an optimal development experience.
- React Development Environment:
Writing the "Hello, World!" React Application
Follow these steps to create your first React application:
Step 1: Create a New React App
Open your terminal and run the following command:
npm create vite@latest hello-world
- It will ask you to Select a framework – Select React ( move up and down with arrow keys )
- Select a varient – Choose as per your preference ( If not sure, Select Javascript )


Step 2: Navigate to Your Project Directory
cd hello-world
Step 3: Install dependencies
Run the npm install command to install all the required dependencies
npm install
Step 4: Start the Development Server
Run the following command to start the development server:
npm run dev
This will launch your app in the default web browser at http://localhost:5173.
Step 5: Modify the App Component
Open the src folder in your project.
Locate the App.js file and open it in your editor.
Replace the existing code with the following:
import React from 'react';
function App() {
return (
<div>
<h1>Hello, World!</h1>
</div>
);
}
export default App;
Explanation of the Code:
import React from ‘react’;: Imports the React library.
function App() {}: Defines a functional component called App.
<div>: A container element that wraps the content.
<h1>: A heading tag that displays “Hello, World!”.
export default App;: Makes the App component available for use in other parts of the application.
Step 5: Save Your Changes
Save the App.js file and switch to your browser. You should see “Hello, World!” displayed on the page.
Next Steps
Now that you’ve created your first React app, here are some ideas to continue your journey:
- Learn about React props and state for building dynamic components.
- Explore React hooks like useState and useEffect.
- Dive into advanced topics such as routing with React Router and state management with Redux.
React is a powerful library, and “Hello, World!” is just the beginning. Keep experimenting and building to master this incredible tool!

Your First “Hello, World!” in HTML
