Setting Up Your First React App with Create React App

🚀 Setting Up Your First React App with Create React App

React is a JavaScript library for building user interfaces, and Create React App (CRA) is the easiest way to start building a React application without having to set up complex tools and configurations manually.


✅ Prerequisites

Before you start, make sure you have these installed on your machine:


Node.js (comes with npm): Download here


A code editor (e.g., Visual Studio Code)


🛠️ Step 1: Install Create React App

Open your terminal (Command Prompt, PowerShell, or Terminal on Mac/Linux), and run this command:


bash

Copy

Edit

npx create-react-app my-first-react-app

npx is a tool that comes with Node.js.


create-react-app is the package that sets everything up for you.


my-first-react-app is the name of your project folder (you can change this to anything you like).


📦 This command will:


Create a new project folder.


Install React and other necessary tools.


Set up a complete React project structure.


📂 Step 2: Navigate into Your Project Folder

Once the setup is complete, go into your project directory:


bash

Copy

Edit

cd my-first-react-app

▶️ Step 3: Start the Development Server

Now you can launch your app in your browser:


bash

Copy

Edit

npm start

This will:


Compile your React code.


Open the app in your browser (usually at http://localhost:3000).


You’ll see the default React welcome page — and just like that, you're running your first React app! 🎉


🧭 Folder Structure (Brief Overview)

Here’s what you’ll find inside your project:


csharp

Copy

Edit

my-first-react-app/

├── node_modules/       # App dependencies

├── public/             # Static files

├── src/                # React components & code

│   └── App.js          # Main component

├── package.json        # Project metadata & dependencies

└── README.md           # Project description

🛠️ Step 4: Start Editing!

Open src/App.js in your code editor and change the text. For example, replace:


jsx

Copy

Edit

<h1>Hello World</h1>

Then save it — your browser will automatically refresh with your changes thanks to Hot Reloading!


🔚 Wrapping Up

That’s it! You’ve just created and run your first React app using Create React App. Now you can start building components, adding styles, and making your app interactive.

Learn React JS Course in Hyderabad

Visit Our Quality Thought Training in Hyderabad

Get Directions 

Read More

What is React.js? A Beginner’s Introduction

How to Handle Events in React JS


Comments

Popular posts from this blog

Understanding Snowflake Editions: Standard, Enterprise, Business Critical

Why Data Science Course?

How To Do Medical Coding Course?