React常用命令筆記

 

初始專案

法1.(不汙染環境方式,每次都會暫時下載create-react-app cli用完就刪除)
新增一個專案folder後cd到該層並下
npx create-react-app .


法2.(需要全域性安裝影響環境方式)
一開始環境要記得先全域性下創建專案用的CLI
npm install -g create-react-app

create-react-app 專案(目錄)名稱
再cd 到專案(目錄)名稱下也可


運行專案

npm start
npm run start

依賴套件安裝

npm i 套件名
yarn add 套件名

比如
npm i react-router-dom

yarn add react-router-dom




Ref:
Difference between npm start and npm run start
https://stackoverflow.com/questions/51358235/difference-between-npm-start-and-npm-run-start

What is the --save option for npm install?
https://stackoverflow.com/questions/19578796/what-is-the-save-option-for-npm-install
https://stackoverflow.com/questions/40868494/what-is-the-s-in-npm-i-s



留言

這個網誌中的熱門文章

經得起原始碼資安弱點掃描的程式設計習慣培養(五)_Missing HSTS Header

經得起原始碼資安弱點掃描的程式設計習慣培養(三)_7.Cross Site Scripting(XSS)_Stored XSS_Reflected XSS All Clients

(2021年度)駕訓學科筆試準備題庫歸納分析_法規是非題