how to start learning to react js

how to install react js in windows?
First of all, we required vs code editor this is preferable. And the very important thing that node Js should be the latest version so go to and install the LTS version.  After then restart your system.

And run your vs code editor, go to the terminal section where you can find from the ctrl+` and then go to your choose folder where you want to install and run this command “npm install -g create-react-app” where you want to create a new project.

F:\other\react>npm install -g create-react-app

How to create a new project to react?
As you want to start then run command “npm create-react-app myNewAppName”.
Also, you can use this command for the latest react code:  “npx create-react-app myNewAppName”. The new folder name should be in small letters as “mynewappname” this not “myNewAppName”.
Also, you can create a simple create-react-app myNewAppName it will create a new project.

You can not create your app name in the camelcase it will take only small letters.

After installing go to the inside folder and then run a server with this command: “npm start”. As given below instruction...

F:\other\react>npx create-react-app myappname

After installing packages you will use the below command.
F:\other\react>cd myappname
F:\other\react>myappname>npm start

npx create-react-app myappname
cd myappname
npm start


You will get a screen as shown below and your project will run on the browser with this URL: http://localhost:3000/



This is done your first react project :).

What is the difference between npm and npx?
npm means you will get files old version but if you will use npx then you will get the latest version files. So always use npx.

Also, you can create a simple create-react-app myNewAppName it will create a new project but when your create-react-app will be globally latest. 
  


After then you will see something like that code:
cd mynewapps
  npm start

Happy hacking!


 Now you have created project. :)

3 comments:

Note: Only a member of this blog may post a comment.

Copyright Reserved to Anything Learn. Powered by Blogger.