2016-08-29 14 views
4

を再描画ではない私は、ユニバーサルに取り組んでいるプロジェクトを反応させるのは、私のクライアントのエントリポイントは次のとおりです。wepback 2ホットリロードは

コンポーネントの変化について

import React from 'react' 
 
import {render} from 'react-dom' 
 
import {Provider} from 'react-redux' 
 
import {AppContainer} from 'react-hot-loader' 
 
import {Router, browserHistory} from 'react-router' 
 
import {syncHistoryWithStore} from 'react-router-redux' 
 
import {addLocaleData} from 'react-intl' 
 
import it from 'react-intl/locale-data/it' 
 
import en from 'react-intl/locale-data/en' 
 
import IntlProvider from 'shared/containers/IntlProvider' 
 
import configureStore from 'shared/configureStore' 
 
import routes from 'shared/routes' 
 
import {isDev, isLive} from 'shared/config' 
 

 
[en, it].forEach(addLocaleData) 
 

 
const hook = document.getElementById('app') 
 
const initialState = JSON.parse(hook.getAttribute('data-initial-state')) 
 
const store = configureStore(initialState) 
 
const history = syncHistoryWithStore(browserHistory, store) 
 
let content = (
 
    <Provider store={store}> 
 
    <IntlProvider key="intl"> 
 
     <Router history={history}> 
 
     {routes} 
 
     </Router> 
 
    </IntlProvider> 
 
    </Provider> 
 
) 
 

 
if (isLive) { 
 
    content = <AppContainer>{content}</AppContainer> 
 
} 
 

 
function renderApp() { 
 
    render(content, hook) 
 
} 
 

 
if (isLive) { 
 
    module.hot.accept('./index.js') 
 
    module.hot.accept('../shared/routes', renderApp) 
 
} 
 

 
renderApp()

、リロードが動作しているようですが、ありませんレンダリングが適用されます.. おそらく、ホットリロードのトリックが起こる前に起こるでしょうか?

console output

NOTE私のルート設定は、今のところ、古典的な非dymanicルートです。

答えて

0

私はちょうど

if (module.hot) { 
module.hot.accept(
    "./App", 
    () => { 
     const NextApp = require("./App").App; // THIS LINE 
     render(NextApp); 
    }, 
); 

}

を交換するモジュールのコードを追加するのを忘れたので、私は同じ問題を抱えていました
関連する問題