-
-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Hot reloading resources outside of React (server rendering) #340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Might be related: #301 |
I think we want to understand how to do this before 1.0 is shipped. |
@mridgway cool I never considered server side hot reloading! Do you have a code example? |
@wmertens This isn't server-side hot reloading. The client bootstrapping code has to be moved outside of React when rendering on top of existing markup vs. rendering fully on the client. |
Does something like import * as reducers from './reducers';
// ...
let store = createStore(combineReducers(reducers));
// ...
React.render(<Stuff />, ...);
if (module.hot) {
module.hot.accept('./reducers', function () {
store.replaceReducer(combineReducers(reducers));
});
} work? |
Let's continue the discussion in #350. |
Now we encourage people to use hot module replacement API directly, so that you have full control: #667 |
The examples that show hot reloading of reducers depend on the redux instance being instantiated within a React component. This works for client-only apps, but when you use server-rendering, you need to bootstrap the application and its state prior to calling
React.render
. Many of the isomorphic examples I've looked at do not work with hot reloading because the reducers are required from a client bootstrap file instead of the top-level app component. It seems like there would have to be somemodule.hot
magic for hot reloading within server-rendered apps.The text was updated successfully, but these errors were encountered: