Create First App
In this chapter, we will learn how to create an app in ReactJs. So first we will create the app using npx and then we remove some unnecessaries files and folders from the react app which will make it easy to understand its working and code syntax.
So follow the below steps and create a react app.
Step 1: Create an App using npx:
Open your terminal or (Visual Studio code) and run the following command to create a new React app using Create React App:
npx create-react-app my_app
This command sets up a new React project with a default folder structure and necessary configurations.
Step 2: Navigate to the Project:
cd my_app
Step 3: Run the App:
Start the development server by running:
npm start
This command launches the app in your default web browser. You can access it at http://localhost:3000/. The page will automatically reload if you make edits.
The following output will be displayed in the browser

Your app is ready. Now we will explore its directory structure and remove unnecessaries files and folders and write our first code in react.
This is the default directory structure.

Now delete all the unnecessaries files like:
Src directory: App.css, index.css, reportWebVitals.js, setupTests.js, App.test.js, logo.svg
Public directory: favicon.ico, logo192.png, logo512.png, manifest.json, robots.txt
This is the fresh directory structure after deleting all unnecessaries.

Now understand and write pieces of code in these files.
index.html
The index.html file serves as the entry point for a React app. It's the first HTML file that a web browser loads when a user visits a React website or application.
This file contains a When the React application starts, it finds this specified element in the index.html file and injects the rendered React component tree into it. The entry point for the application where ReactDOM or React Native is used to render the main component. No need to more change this file. if you deleted the reportWebVitals.js file from src directory then only comment on removing the reportWebVitals() method and its imported file. This is the first component of react app that represents the root of the application.index.js
App.js
Output
