File tree Expand file tree Collapse file tree 3 files changed +39
-26
lines changed Expand file tree Collapse file tree 3 files changed +39
-26
lines changed Original file line number Diff line number Diff line change
1
+ NuclearJS Hot Reloading
2
+ ===
3
+
4
+ NuclearJS supports hot reloading of stores. Using the webpack Hot Module Replacement simply code like this to wherever your stores are registered.
5
+
6
+
7
+ ``` js
8
+ import { Reactor } from ' nuclear-js'
9
+ import * as stores from ' ./stores'
10
+
11
+ const reactor = new Reactor ({
12
+ debug: true ,
13
+ })
14
+ reactor .registerStores (stores)
15
+
16
+ if (module .hot ) {
17
+ // Enable webpack hot module replacement for stores
18
+ module .hot .accept (' ./stores' , () => {
19
+ reactor .replaceStores (require (' ./stores' ))
20
+ })
21
+ }
22
+
23
+ export default reactor
24
+ ```
25
+
26
+ ## Running Example
27
+
28
+ ```
29
+ npm install
30
+ npm start
31
+ ```
32
+
33
+ Go to [ http://localhost:3000 ] ( http://localhost:3000 )
34
+
35
+ ## Inpsiration & Thanks
36
+
37
+ Big thanks to [ redux] ( https://github.com/rackt/redux ) and [ react-redux] ( https://github.com/rackt/react-redux ) for proving out this architecture
38
+ and creating simple APIs to accomplish hot reloading.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ const reactor = new Reactor({
7
7
reactor . registerStores ( stores )
8
8
9
9
if ( module . hot ) {
10
- // Enable Webpack hot module replacement for reducers
10
+ // Enable Webpack hot module replacement for stores
11
11
module . hot . accept ( './stores' , ( ) => {
12
12
reactor . replaceStores ( require ( './stores' ) )
13
13
} )
You can’t perform that action at this time.
0 commit comments