-
Notifications
You must be signed in to change notification settings - Fork 792
Closed
Description
It seems that RHL3 breaking connect with redux store. See .gif in the end of issue
react: 15.4.2
react-redux: 5.0.3
react-router: 4.0.0
react-hot-loader: 3.0.0-beta.6
index.js
import { AppContainer as HotContainer } from 'react-hot-loader'
import React from 'react'
import ReactDOM from 'react-dom'
import App from './App'
import { configureStore } from './store'
const store = configureStore()
const root = document.getElementById('root')
const render = (Component, store) =>
ReactDOM.render(
<HotContainer>
<Component store={store} />
</HotContainer>,
root
)
render(App, store)
if (module.hot) {
module.hot.accept('./App', () => {
const NextApp = require('./App').default
render(NextApp, store)
})
}store/index.js
import { createStore, applyMiddleware, compose } from 'redux'
import reducer from '../reducers'
import apiMiddleware from '../middlewares/apiMiddleware'
const enhancer = compose(
applyMiddleware(apiMiddleware),
window.devToolsExtension ? window.devToolsExtension() : f => f
)
export function configureStore(init) {
const store = createStore(reducer, {}, enhancer)
if(module.hot) {
module.hot.accept('../reducers/', () => {
const nextReducer = require('../reducers/index').default
store.replaceReducer(nextReducer)
})
}
return store
}gajus, kromit and gregberge
Metadata
Metadata
Assignees
Labels
No labels
