-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
try to call render after module executed
- Loading branch information
Showing
2 changed files
with
30 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,3 @@ | ||
import React from 'react' | ||
import ReactDOM from 'react-dom' | ||
import { Provider } from 'react-redux' | ||
import configureStore from './store' | ||
import { render } from './main' | ||
|
||
import DevTools from './containers/dev_tools' | ||
import Counter from './containers/counter' | ||
import HelloWorld from './containers/hello_world' | ||
import reducers from './reducers/index'; | ||
|
||
const store = window.__store || configureStore(reducers) | ||
delete window.__store | ||
|
||
export function __unload() { | ||
window.__store = store; | ||
} | ||
|
||
export function __reload(deletedModule) { | ||
store.replaceReducer(reducers) | ||
} | ||
|
||
ReactDOM.render(( | ||
<Provider store={store}> | ||
<div> | ||
<HelloWorld /> | ||
<Counter /> | ||
<DevTools /> | ||
</div> | ||
</Provider> | ||
), document.getElementById('app')) | ||
render(document.getElementById('app')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react' | ||
import ReactDOM from 'react-dom' | ||
import { Provider } from 'react-redux' | ||
import configureStore from './store' | ||
|
||
import DevTools from './containers/dev_tools' | ||
import Counter from './containers/counter' | ||
import HelloWorld from './containers/hello_world' | ||
import reducers from './reducers/index'; | ||
|
||
export let store = configureStore(reducers) | ||
|
||
export function __reload(deletedModule) { | ||
store = deletedModule.store | ||
store.replaceReducer(reducers) | ||
} | ||
|
||
export function render(element) { | ||
ReactDOM.render(( | ||
<Provider store={store}> | ||
<div> | ||
<HelloWorld /> | ||
<Counter /> | ||
<DevTools /> | ||
</div> | ||
</Provider> | ||
), element) | ||
} |