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
- NodeJS downloads
- For Ubuntu
# Using Ubuntu curl -sL https://deb.nodesource.com/setup\_14.x | sudo -E bash - sudo apt-get install -y nodejs
- To check if node is installed type
node --version
in the terminal
Creating React App:
- TLDR;
npx create-react-app my-app
. Here 'my-app' is the folder where React app will be created. - 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?
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?
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)