DEV Community

sushmeet sunger
sushmeet sunger

Posted on

How to Install React in 5 minutes

Heard a lot about React!! Looking to give it a try on your computer but unsure as to how you can set up your development environment. No worries we got you covered.

Firstly let's ensure you have NodeJS installed on your machine.
We will install nvm (node version manager) which will in turn let us install multiple versions of NodeJS, so we can choose whichever one we need to run.

Type the below command to get the latest

nvm install node
Enter fullscreen mode Exit fullscreen mode

If you don't have nvm than you can first try installing nvm.

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
Enter fullscreen mode Exit fullscreen mode

We will install a React Application and have it configured with Visual Studio Code (VS Code) which will allow you to edit, and create new react apps.

  • Install VS code by going to the side VS Code Site here
  • Once installed, open VS code, and open an Integrated Terminal within VS Code. You can do this by Use the View > Terminal or Terminal > New Terminal menu commands.
  • Now go to this Integrated Terminal and ensure that you are in the space where you want to create your project. So if you want to create your project in documents just type.
cd Documents 
Enter fullscreen mode Exit fullscreen mode
  • Once you are in the location, that you want to create your code folder, type the following command below. So in the command below where I have nameOfYourAppHere you can put any name for your app, so whatever you like.
npx create-react-app nameOfYourAppHere
Enter fullscreen mode Exit fullscreen mode
  • Once this is done you should have React and all of it's package dependencies installed
  • Now let's start you React Application by typing
cd nameOfYourAppHere
npm start
Enter fullscreen mode Exit fullscreen mode
  • In your browser go to http://localhost:3000
  • You will see the react logo spinning and that is your application.

Top comments (0)