Skip to content

Commit 66c875c

Browse files
committed
Hot unreload stores
1 parent 7cf737d commit 66c875c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/utils/makeHot.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
function makeHot(alt, Store, name = Store.displayName) {
2+
if (module.hot) {
3+
module.hot.dispose(() => {
4+
delete alt.stores[name]
5+
})
6+
}
7+
8+
return alt.createStore(Store, name)
9+
}
10+
11+
export default makeHot

0 commit comments

Comments
 (0)