vebits / react-boilerplate-app

A simple hot React app with webpack, routing, babel, dev server, css loader.
MIT License
7 stars 8 forks source link

What is 'hot' about this boilerplate app? #2

Open mikelambert opened 7 years ago

mikelambert commented 7 years ago

I see it linked from https://github.com/gaearon/react-hot-loader/tree/master/docs#starter-kits with description:

react-boilerplate-app (react (duh), router, webpack with dev server, babel, hot reloading)

And the README.md says:

A simple hot React app with webpack, routing, babel, dev server, css loader.

But I cannot find any hot-reloading code anywhere in this project...?

vebits commented 7 years ago

It is using the react-hot-loader dependency.

mikelambert commented 7 years ago

Don't you need to be running an actual hot server (that will check for updates, and send updates to the client) in order for this to actually work as a hot reloader?

import webpack from 'webpack';
import hotMiddleware from 'webpack-hot-middleware';
const compiler = ...a new webpack, containing an webpack.HotModuleReplacementPlugin instance
app.use(hotMiddleware(compiler));

And don't the rendered components need to use react-hot-loader to ensure they know to ask the server for updates?

import { AppContainer } from 'react-hot-loader';
ReactDOM.render(<AppContainer><MyActualComponent</AppContainer>, ...)

These were both necessary to make a hot reloader actually work for me, and this project doesn't have either of them. It just has the .babelrc reference (which I also had, but found to be insufficient).

Sedaj commented 7 years ago

Yes this doesn't work and need to be removed

davidfufu commented 7 years ago

Yup, hot reloading doesn't work here.