Node Package Module is a Node.js package manager, that is used for creating Node projects and also adding Node packages and libraries.
Used to create a Node Project in the current folder. You can specify the name, description, etc.. or just add the -y flag for default values.
npm init # Prompts for custom options
npm init -y # Start the project with default options
Used to install libraries in the current project. Can be used as npm i, and with the flag —save-dev to tell the Package manager that this is only for development, and does not need to be included in public releases.
npm install [libraryName] # Install library to the project
npm i [libraryName] # Shorthand to npm install
npm i [libraryName] --save-dev # Only for development
Use this instead of npm init to create a React Template Project
# Create Base Node Project/App
npx create-react-app [appName]
We will be using JSX (Javascript Syntax Extension) as our default syntax extension. It uses a very similar structuring system to HTML's.
Every React Component should start with an Uppercase letter, in contrary to a normal JS function. That is the Syntax convention created around React.
// Native
let Element = React.createElement("h1", null, "Hello, world")
// JSX
Element = <h1>Hello, world!</h1>;
const createHello = (name) => `Hello, ${name}!`;
const TextElement = <p>{createHello('George')}</p>;
const containerClass = 'hello-container';
const Container = <div className = {containerClass}>{TextElement}</div>