[MST] Restore the Model Tree State using Hot Module Reloading when Model Definitions Change

Posted Answer1215

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[MST] Restore the Model Tree State using Hot Module Reloading when Model Definitions Change相关的知识,希望对你有一定的参考价值。

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()
    })
}

 

以上是关于[MST] Restore the Model Tree State using Hot Module Reloading when Model Definitions Change的主要内容,如果未能解决你的问题,请参考以下文章

[kuangbin带你飞]专题六 最小生成树 K - The Unique MST (判断最小生成树是否唯一)

POJ-1679 The Unique MST---判断最小生成树是否唯一

POJ-1679 The Unique MST (判断最小生成树的唯一性)

poj 1679 The Unique MST (次小生成树(sec_mst)kruskal)

The Unique MST

The Unique MST