React-hot-loader: Difference between react-hot-loader, webpack-hot-client, webpack-hot-middleware?

Created on 1 Apr 2018  路  5Comments  路  Source: gaearon/react-hot-loader

Description

More explanation

Environment

React Hot Loader version: recent stable

  1. node -v: 8.9.4
  2. npm -v: 5.6.0
  3. Operating system: Ubuntu 16.04.3 LTS, xenial
  4. Browser and version: Chrome 63.0.3239.132 (Official Build) (64-bit)

Question

What is the difference between react-hot-loader and webpack-hot-client (webpack-hot-middleware)?

I'm developing React+Express application.
I use Webpack to build assets and compile React.
I use webpack-serve as a dev server. This dev server features HMR out-of-the-box (it uses both, webpack-hot-client and webpack-hot-middleware).

Do I need to use react-hot-loader if I use webpack-serve? Why? Could you please explain what exactly react-hot-loader does?

docs help wanted

Most helpful comment

I think it is a good idea, we have a lot of confusion between these packages.

All 5 comments

I think it is a good idea, we have a lot of confusion between these packages.

react-hot-loader - client side library(+babel plugin), to perform React Component hot-updates.
webpack-hot-client - server side library, watches for fs changes and sends updates to a client.
webpack-hot-middleware - mixed (more client), some additional code, to make hot-module-replacement work. More concrete - accept updates from webpack-hot-client.

And you need __all this stuff__, as long react-hot-loader works atop webpack-hot-middleware, which is a part of webpack-hot-client.

@theKashey I have made a express server and use only webpack-hot-middleware(&webpack-dev-middleware) but without react-hot-loader, my react component(&mobx store) is already get hot updated.
so what's the purpose of react-hot-loader? is it really necessary?

@theKashey I have made a express server and use only webpack-hot-middleware(&webpack-dev-middleware) but without react-hot-loader, my react component(&mobx store) is already get hot updated.
so what's the purpose of react-hot-loader? is it really necessary?

I didn't get hot updated, but i have this confusion, too

so what's the purpose of react-hot-loader? is it really necessary?

Keep the state of your application. Global store, local store, hooks, refs, everything.
Without RHL you will get no more than full page refresh, potentially keeping some stuff like redux-store defined above hot

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mtscout6 picture mtscout6  路  3Comments

reintroducing picture reintroducing  路  4Comments

lemonmade picture lemonmade  路  3Comments

sandysaders picture sandysaders  路  4Comments

rockchalkwushock picture rockchalkwushock  路  3Comments