I have a React app with a webpack build. I am using Webpack HMR using React-Hot-Loader. I configured it as the documentation, and everything is working fine except for one place.
I have a non-react library to display map from map-box API (mapbox-gl).
In the react component, I create a <div>
with ref
, and initialize the mapbox-gl code into the ComponentDidMount
method.
I run this code on ComponentDidMount:
ComponentDidMount() {
const map = new mapboxgl.Map({
container: this._map_div_ref,
.....
})
}
When this map is used in webpack-HMR, the code on ComponentDidMount doesn't run, so when the HMR update the browser, it empty the map_div
Is there a way to tell webpack-HMR to run that code?