added if statement in onRemove() function (#555)

Added an if statement in onRemove() function that checks if "this.div" is defined before calling ReactDOM.unmountComponentAtNode(this.div). This is done to avoid throwing an "unmountComponentAtNode(...): Target container is not a DOM element" error. I ran into this error while using google-map-react with React Router and switching between tabs rapidly to stress test my application.
This commit is contained in:
kal 2018-04-17 13:20:09 -04:00 committed by Michael Diego
parent 9d0b3939ba
commit 147997c5f7

View File

@ -610,7 +610,7 @@ export default class GoogleMap extends Component {
},
onRemove() {
ReactDOM.unmountComponentAtNode(this.div);
if(this.div) ReactDOM.unmountComponentAtNode(this.div);
},
draw() {