Frontend/進階_React框架/docs/Nodejs.md
2025-02-08 00:44:29 +08:00

62 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Nodejs與npm
##Nodejs:一個不需要開啟網頁就能夠執行javascript的環境
##npm(node package manager): 一個套件管理工具類似於pip、nuget
npm這個工具本身是由javascript寫出來的所以npm和nodejs才會綁在一起下載
使用React前端框架照理說不需用到Nodejs但是需要npm去安裝一些前端框架會用到的工具
常用套件工具:
React 本體react、react-dom)
開發工具Vite / Webpack
TypeScript 支援(若使用 TypeScript
狀態管理Redux, Zustand
UI 框架Tailwind CSS, Material UI
前端路由React Router
API 請求axios, fetch
# Vscode編譯器
vscode本身沒有支援npm需去下載nodejshttps://nodejs.org/zh-tw
下載完vscode終端檢查有無node.js
```
node -v
```
檢查有無npm
```
npm -v
```
# Package.json
這個跟nuget一樣會有一個dependencies去記錄你安裝的套件
```
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.7.0"
}
```
當別人拿到你的程式碼時,他們只需要執行
```
npm install
```
先下載Node.js 並安裝
於準備開發的資料夾下方開啟CMD
檢查有無node.js
```
npm -v
```
# React
## 基於VUE 可以更有效率地進行前端省了很多路由部分可以直接創建Page即可開始
先下載Node.js 並安裝
於準備開發的資料夾下方開啟CMD
檢查有無node.js
```
npm -v
```