Skip to content

Commit d6bffda

Browse files
authored
Merge pull request #1187 from kengreeff/update-install-docs
Update install instructions in README.md
2 parents b1a9bd7 + 1ad57dc commit d6bffda

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

README.md

+16-15
Original file line numberDiff line numberDiff line change
@@ -66,21 +66,23 @@ const App = () => <div>Hello World!</div>
6666
export default hot(App)
6767
```
6868

69-
There is also old version of `hot`, used prior version 4.5.4. **Please use a new one**,
70-
as it is much more resilient to js errors you may make during development.
69+
3. [Run webpack with Hot Module Replacement](https://webpack.js.org/guides/hot-module-replacement/#enabling-hmr):
70+
71+
```sh
72+
webpack-dev-server --hot
73+
```
74+
75+
### Old API
76+
77+
**Note:** There is also an old version of `hot`, used prior to version 4.5.4. **Please use the new one**,
78+
as it is much more resilient to js errors that you may make during development.
7179

7280
```js
7381
import { hot } from 'react-hot-loader'
7482
const App = () => <div>Hello World!</div>
7583
export default hot(module)(App)
7684
```
7785

78-
3. [Run webpack with Hot Module Replacement](https://webpack.js.org/guides/hot-module-replacement/#enabling-hmr):
79-
80-
```sh
81-
webpack-dev-server --hot
82-
```
83-
8486
## Limitations
8587

8688
* (that's the goal) React-Hot-Loader would not change the past, only update the present - no lifecycle event would be called on component update.
@@ -237,11 +239,10 @@ Using React Hot Loader with React Native can cause unexpected issues (see #824)
237239

238240
## Webpack plugin
239241

240-
We recommend to use `babel` plugin, but there are situations when you are unable to use it, then - try webpack loader (as seen in v3)
241-
to have at least _something_.
242-
Remember - it is **not compatible** with class-based components - as long as babel plugin
243-
would inject a special methods to the every class, to make `class members`(like onClick) hot-updatable,
244-
while webpack-plugin would leave classes as is, without any _instrumentation_.
242+
We recommend using the `babel` plugin, but there are some situations where you are unable to. If so, try the `webpack` plugin / `webpack-loader` (as seen in v3).
243+
244+
Remember - the `webpack` plugin is **not compatible** with class-based components. The `babel` plugin
245+
will inject special methods to every class, to make `class members` (like onClick) hot-updatable, while the `webpack` plugin would leave classes as is, without any _instrumentation_.
245246

246247
```js
247248
class MyComponent extends React.Component {
@@ -251,7 +252,7 @@ class MyComponent extends React.Component {
251252
}
252253
```
253254

254-
But webpack-loader could help with TypeScript or _spreading_ "cold API" [to all node_modules](https://github.com/gaearon/react-hot-loader#disabling-a-type-change-for-all-node_modules).
255+
But `webpack-loader` could help with TypeScript or _spreading_ "cold API" [to all node_modules](https://github.com/gaearon/react-hot-loader#disabling-a-type-change-for-all-node_modules).
255256

256257
> It is safe to enable this loader for all the files. But place it after babel-loader, if babel-loader is present.
257258
@@ -523,7 +524,7 @@ export default hot(module)(App)
523524

524525
### `AppContainer`
525526

526-
Mark application as hot reloadable. (**Prefer** using `hot` helper)
527+
Mark application as hot reloadable. (**Prefer** using `hot` helper, see below for migration details).
527528

528529
This low-level approach lets you make **hot **imports\_\_, not exports.
529530

0 commit comments

Comments
 (0)