Skip to main content

Building React App

 Creating an App

Need to have Node >= 10 on local development machine (but it’s not required on the server). You can use nvm (macOS/Linux) or nvm-windows to switch Node versions between different projects.

( default npm install -g will install to c:/users/user_name/node_modules/bin)


For npm 5.1 or earlier, you can't use npx. Instead, install create-react-app globally:

npm install -g create-react-app

And Run

create-react-app my-app

For NPM 6 and higher

npm init react-app my-app

Or NPX Command to quick start (npx comes with npm 5.2+ and higher)

npx create-react-app my-app
cd my-app

npm start

YARN
yarn create react-app my-app

Selecting a package manager

When you create a new app, the CLI will use Yarn to install dependencies (when available). If you have Yarn installed, but would prefer to use npm, you can append --use-npm to the creation command. 

for NPM
npx create-react-app my-app --use-npm

Creating a TypeScript app

You can start a new TypeScript app using templates. To use our provided TypeScript template, append --template typescript to the creation command
npx create-react-app my-app --template typescript

Comments

Popular posts from this blog

API Basics

 

Algorithm solving Common Patterns & Techniques

  These are targeted data manipulation strategies used to handle arrays, strings, and linked lists efficiently. Two Pointers : Uses two reference pointers to iterate through a data structure simultaneously, typically from opposite ends or at different speeds (Fast & Slow pointers). Sliding Window : Maintains a subset of data (a "window") over a sequential structure to track running statistics without recalculating the whole set. Prefix Sum : Pre-computes and stores cumulative sums of an array to allow for \(O(1)\) constant-time range sum queries. Dynamic Programming (DP ): Dynamic programming is an optimization technique used to solve problems by breaking them down into simpler subproblems and storing the results of these subproblems to avoid redundant computations. It is particularly effective for problems exhibiting overlapping subproblems and optimal substructure. Greedy Algorithm Breadth-First Search (BFS) / Depth-First Search (DFS) : Systematic graph and tree travers...