Environment setup for React app (Ubuntu)

Overview:

In this article, you'll see an easy and effective way to setup and create your first React app locally on Ubuntu.

Installing NodeJS via package manager

  1. NodeJS downloads
  2. For Ubuntu
  3. # Using Ubuntu curl -sL https://deb.nodesource.com/setup\_14.x | sudo -E bash - sudo apt-get install -y nodejs
  4. To check if node is installed type node --version in the terminal

Creating React App:

  1. TLDR; npx create-react-app my-app. Here 'my-app' is the folder where React app will be created.
  2. Create React App - Guide.

Questions:

Q1. What is the difference between npx and npm? In creating React app, both could be used to issue a command which created React Apps. Is one better than the other for creating React Apps?

-> StackOverFlow

TLDR; NPX executes packages and hence is preferable, while NPM can only manage packages so is not that good for creating a react app

Q2. What are packages?

-> Answer at nodejs.org

A package in Node.js contains all the files you need for a module. Modules are JavaScript libraries you can include in your project. source - W3Schools

Q3. What does 'managing-packages' exactly mean? (Ironic given the first heading of this article)

-> Answer at MDN