Create Your first React App

Bibek Lamichhane
3 min readJun 30, 2023

--

Get started with React !

Photo by Lautaro Andreani on Unsplash

Introduction

Its always a confusing time when you wanted to start something new but could not find the reference or tutorial from scratch.Basically we will be creating a hello-world react app to get started with it.

Requirements

We will install nodebefore we create our app.You can click to go to node to install it.

Creating the App:

Now that we have our environment setup, let’s create our app.we will name this project as ‘firstapp’

Command:

Go to your terminal and type the command as :

$ npx create-react-app firstapp
After running command

React Project Structure:

After successfully creating our app,lets us look at the folder structure.The project structure consists of the following files as shown in the output.

Working structure

node_modules:

This folder contains all the standard node packages that have been installed via npm

package.json:

This file lists all the node package dependencies and project configurations

package.json

package-lock.json:

package-lock.json is automatically generated for any operations where npm modifies either the node_modules tree, or package.json.

public folder:

This holds all your development files, your logo icons, favicon.ico, index.html etc.The index file is displayed at http://localhost:3000.

The App.js file in the src folder has the boiler plate codefor our hello-world app.

App.js default

More terms to know

Components:

What are components?

Well as the name says,components are a pieces of code that are resusable.Props are used to pass the value from the one components as from child to parents.

JSX:

JSX are nothing but HTML inside the javascript.Since HTML cannot be written in javascript a new method was introduced to write as JSX.More information can be found on the documentation.

Starting the app:

Now that we have discussed enough about the project structure, let’s get started with the execution and see how our first app looks like.

In your terminal just type

$npm start
Starting react app
React app in browser

Hello world

As everything is working fine its time to run our favourite line of code,yes you guess it right it’s “Hello World” .

Hello World in browser

And that’s it you just run the ‘Hello World’ program in your browser

Your next task is to remove all the unnecessary code from app.js and then run a clean hello world program.

App.js
React app in browser

Congratulations you just created your first React app.Your next task will be continuing to learn the concepts of react.js.The best will be if you overlook at the documentation.

Thank you for your time,will be uploading about React futher.See you soon!

--

--

Bibek Lamichhane
Bibek Lamichhane

Written by Bibek Lamichhane

Dont let your smile fade .... Loves to code with React.js || Node.js || Django

No responses yet