gaearon / react-hot-loader

Tweak React components in real time. (Deprecated: use Fast Refresh instead.)

Home Page:http://gaearon.github.io/react-hot-loader/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

inconsistent documentation

havenchyk opened this issue · comments

Getting started section says:

Make sure react-hot-loader is required before react and react-dom:
- or import 'react-hot-loader' in your main file (before React)
- or prepend your webpack entry point with react-hot-loader/patch, for example:
// webpack.config.js
module.exports = {
  entry: ['react-hot-loader/patch', './src'],
  // ...
};
If you need hooks support, use @hot-loader/react-dom

On the other hand migrate from create-react-app section doesn't care about order of the import or @hot-loader/react-dom.

Also when I asked @theKashey on twitter about the state of hooks support, he answered that they should "just work" out of the box.

Before I provide a PR, can somebody confirm that

  1. order of the import doesn't matter, prepend is not needed
  2. docs from create-react-app section are more valid than latest one
  3. no additional tweaks via setConfig usually are needed
  1. Order of imports matters
  • it was crucial to import RHL before React/ReactDOM to prevent cyclic dependency
  • it still has to be imported before your own code
  1. docs from create-react-app section are more valid than latest one
  • they have to be updated, and probably never did
  1. no additional tweaks via setConfig usually are needed
  • 💯, should be zero configuration, and I am using RHL without any extra configuration as well.