CREATE REACT APPLICATION

Install node.js


In this react tutorial we are going to create a basic react application. So first of all you need to install node.js from  its official website https://nodejs.org/en/download/ 



You can download node.js as per your system requirement .


Create react app:-

Open your cmd and put command create-react-app [name as your choice ] 


 


And hit enter this process takes time as per your system config .


Once the processing is complete . then run another command npm start which is used to start the application. 




This command starts the react server in 3000 ports .



This is the output when you start the port 


Folder structure:-



 This is a basic file structure when you create a react application. There are two main folders which are public and src.



In the public folder there is only one file that is important, that is index.html.This HTML file is a template.If you open it directly in the browser, you will see an empty page.You can add web fonts, meta tags, or analytics to this file.The build step will place the bundled scripts into the <body> tag.To begin the development, run `npm start` or `yarn start`.To create a production bundle, use `npm run build` or `yarn build`.





This is a index.js file where the data import from app.js 



This is app.js where the data export data 



There is a package.json file where all the packages are stored inside this file .



There is another folder which is node_modules where all package directory are store   

In the src folder we can create components. In the src folder there is two important file one is index.js which is import data from app.js  and show data in index.html

 

Post a Comment

0 Comments