n this lesson, we will set up Hot Module Reloading(HMR), making it possible to load new definitions for React components and MST models and apply them to a running application.

In this lesson you will learn:

  • How HMR roughly works
  • How to accept changes to components
  • How to accept changes to changing model definitions, while keeping state
let wishList = WishList.create(initialState)

function renderApp() {
ReactDOM.render(<App wishList={wishList} />, document.getElementById("root"))
} renderApp() if (module.hot) {
module.hot.accept(["./components/App"], () => {
// new components
renderApp()
}) module.hot.accept(["./models/WishList"], () => {
// new model definitions
const snapshot = getSnapshot(wishList)
wishList = WishList.create(snapshot)
renderApp()
})
}

最新文章

  1. jQuery 参考手册 - 遍历
  2. FusionCharts V3图表导出图片和PDF属性说明(转)
  3. UIImageView属性
  4. 希尔排序(C++版)
  5. openssl rsa 加解密
  6. Kafka分布式消息模型
  7. 深入理解CSS3 Animation 帧动画(转)
  8. Swiftly语言学习1
  9. 解决百度BMR的spark集群开启slaves结点的问题
  10. wsimport 命令不是内部命令
  11. android下载管理、理财、浏览器、商品筛选、录音源码等
  12. Linux内存管理 (5)slab分配器
  13. @resource、@Autowired、@Service在一个接口多个实现类中的应用
  14. Oracle中 (+)与left join 的用法区别
  15. Gym - 100989M(dp)
  16. handsontable 拖动末尾列至前面列位置,被拖动列消失的问题
  17. WinForm通用自动更新器AutoUpdater项目实战
  18. 转: Xshell鼠标选中,终端立即中断(CTRL-C)的问题
  19. Nginx 为 Golang 配置 web 服务
  20. Linux服务器修改时区时间

热门文章

  1. [转载] C 陷阱与缺陷( C traps and Pitfalls )
  2. 基于Linux的v4l2视频架构驱动编写
  3. echarts图表属性说明
  4. CSS的引入方式和样式
  5. SpringBoot2.0中使用自定义properties文件
  6. easyui datagrid 动态加入、移除editor
  7. c# iTextSharp导出PDF
  8. C# 比较两个数据的不同
  9. WPF Template
  10. SpringMVC(一) 简单代码编写,注解,重定向与转发