【React】學習之道

一.工欲善其事必先利其器 - 準備工做

安裝vscode:https://code.visualstudio.com/html

安裝node.js:https://nodejs.org/en/node

安裝gitbash:https://gitforwindows.org/react

 

根據我的習慣將vscode設置成本身喜歡的語言,我這裏設置爲中文git

1.快捷鍵ctrl+shift+p 輸入configlanguage  改成zh-cngithub

安裝中文語言包,而後重啓shell

 

2.把vs code的終端改成git bashnpm

 搜索shell 找到Terminal › Integrated › Shell: Windows,將安裝好的git裏面的bash路徑複製到設置裏windows

 

3.重啓vs codebash

 

二.快速構建一個react應用 

地址:https://reactjs.org/docs/create-a-new-react-app.html#create-react-appapp

 命令:

npx create-react-app my-app
cd my-app
npm start

 

 

執行 npx create-react-app clientsite命令後 給建立了下面這些文件

 

 三.已推送到github,克隆倉庫到本地

git地址:https://github.com/chuankang/React

而後在vs code中選擇文件夾 

克隆下來後 nmp start 運行 報錯

 

由於項目文件夾下沒有node_modules文件夾,上傳git時是被忽略了(200M左右)  執行npm install 而後 npm start 

 

ok

相關文章
相關標籤/搜索