Skip to content

Commit

Permalink
Merge 35aa2ad into 4ac3ff4
Browse files Browse the repository at this point in the history
  • Loading branch information
husseyexplores committed Oct 11, 2019
2 parents 4ac3ff4 + 35aa2ad commit f9dd7c4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/components/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,16 @@ class Modal extends Component {
removePortal = () => {
!isReact16 && ReactDOM.unmountComponentAtNode(this.node);
const parent = getParentElement(this.props.parentSelector);
parent.removeChild(this.node);
if (parent) {
parent.removeChild(this.node);
} else {
// eslint-disable-next-line no-console
console.warn(
'React-Modal: "parentSelector" prop did not returned any DOM ' +
"element. Make sure that the parent element is unmounted to " +
"avoid any memory leaks."
);
}
};

portalRef = ref => {
Expand Down

0 comments on commit f9dd7c4

Please sign in to comment.