国产gaysexchina男同gay,japanrcep老熟妇乱子伦视频,吃奶呻吟打开双腿做受动态图,成人色网站,国产av一区二区三区最新精品

Redux 示例

2021-09-16 09:50 更新

示例

Redux 源碼 中同時包含一些示例。

復制代碼時注意

如果你把 Redux 示例代碼復制到其它目錄,可以刪除位于 webpack.config.js 文件尾部 “You can safely delete these lines in your project.” 注釋后的代碼。

Counter 計數器示例

運行 Counter 示例:

git clone https://github.com/rackt/redux.git

cd redux/examples/counter
npm install
npm start

open http://localhost:3000/

這個示例包含:

  • 基本的 Redux 應用開發(fā)流程;
  • 測試代碼。

TodoMVC 示例

運行 TodoMVC 示例:

git clone https://github.com/rackt/redux.git

cd redux/examples/todomvc
npm install
npm start

open http://localhost:3000/

這個示例包含:

  • Redux 中使用兩個 reducer 的方法;
  • 嵌套數據更新;
  • 測試代碼。

Todos with Undo 示例

運行 todos-with-undo 示例:

git clone https://github.com/rackt/redux.git

cd redux/examples/todos-with-undo
npm install
npm start

open http://localhost:3000/

這個示例包含:

  • Redux 中使用兩個 reducer 的方法;
  • 使用 redux-undo 在 Redux 中實現撤銷/重做功能。

異步

運行 Async 示例:

git clone https://github.com/rackt/redux.git

cd redux/examples/async
npm install
npm start

open http://localhost:3000/

這個示例包含:

  • 使用 redux-thunk 處理簡單的異步開發(fā)流程;
  • 緩存服務器響應數據,并在獲取數據過程中顯示加載進度條;
  • 緩存數據過期方法。

Universal 示例

運行 Universal 示例:

git clone https://github.com/rackt/redux.git

cd redux/examples/universal
npm install
npm start

open http://localhost:3000/

這個示例包含:

  • 使用 Redux 和 React 的 Universal rendering 庫;
  • 經由異步得到輸入的內容,從而提前獲取 state ;
  • 從服務器端向客戶端傳遞 state 。

Real World 示例

運行 Real World 示例:

git clone https://github.com/rackt/redux.git

cd redux/examples/real-world
npm install
npm start

open http://localhost:3000/

這個示例包含:

  • 實際應用中的 Redux 的異步處理;
  • 使用 normalized 結果集來保存并緩存數據;
  • 用于 API 請求的自定義 middleware ;
  • 緩存服務器響應數據,并在獲取數據過程中顯示加載進度條;
  • 分頁器;
  • 路由。

更多

參考 Awesome Redux 獲取更多示例。

以上內容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號