gaearon / gaearon/react-hot-loader
Remount component if componentWillMount\componentDidMount changed
- Dominant language
- JavaScript
- Stars
- 12.2k
- Forks
- 775
- PR merge metrics
- No merged PRs in 30d
Description
Hi!
After reading theKasheys [post](https://habrahabr.ru/post/346142/) (russian language) about RHL v4 i have finally understood how new rhl works (at least i think so). And i have an idea about what you can do with changing `componentWillMount`\\`componentDidMount`.
Now you must reload the page when you change `componentWillMount`\\`componentDidMount`.
If RHL can detect that `componentWillMount`\\`componentDidMount` has changed maybe it will make sense to add in configuration something like
```jsx
import { setConfig } from 'react-hot-loader';
setConfig({ logLevel: 'debug', remountComponentOn: ['cwm', cdm'] });
```
where `cwm` and `cdm` is abbreaviation for` componentWillMount` and `componentDidMount`
And if you have changed the most inner component, it means that parents can preserve their state and remount only the child where `componentWillMount`\\`componentDidMount` has changed. I believe that it will be better than reloading the whole page. At least some state of the app will be saved.
Does this make sense for you? I guess it is real to implement.
Contributor guide
Assessment
This issue has not been assessed yet.