利用create-react-app結合react-redux、react-router4構建單頁應用

來源:互聯網
上載者:User

標籤:tar   結合   裝飾器   log   dev   babel   載入   create   com   

1.建立項目:

  a.全域安裝create-react-app: npm  install  create-react-app  -g

       b.執行create-react-app  my-projectName建立自己的項目,完成之後npm run  start即可啟動項目。

2.引入組件庫、外掛程式配置等:

  a.執行npm install  antd-mobile  --save安裝組件庫

  b.執行npm install  babel-plugin-import  --save安裝按需載入外掛程式

  c.執行npm  run  eject  彈出個人化配置,在package.json中的babel配置項添加按需載入外掛程式配置:

    

3.引入redux、react-redux

  a.執行npm install  redux  --save安裝redux 

  b.執行npm install  redux-thunk安裝thunk外掛程式,使redux可處理非同步作業

  c.執行npm install  react-redux  --save安裝react-redux簡化參數傳遞

  d.執行npm  install  babel-plugin-transform-decorators-legacy --save-dev安裝此外掛程式支援connect的裝飾器寫法

 

4.引入react-router4

  a.執行npm  install  react-router-dom  --save

 

 

   

利用create-react-app結合react-redux、react-router4構建單頁應用

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.