We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 461ace3 commit 3e07113Copy full SHA for 3e07113
src/components/Modal.js
@@ -174,7 +174,16 @@ class Modal extends Component {
174
removePortal = () => {
175
!isReact16 && ReactDOM.unmountComponentAtNode(this.node);
176
const parent = getParentElement(this.props.parentSelector);
177
- parent.removeChild(this.node);
+ if (parent) {
178
+ parent.removeChild(this.node);
179
+ } else {
180
+ // eslint-disable-next-line no-console
181
+ console.warn(
182
+ 'React-Modal: "parentSelector" prop did not returned any DOM ' +
183
+ "element. Make sure that the parent element is unmounted to " +
184
+ "avoid any memory leaks."
185
+ );
186
+ }
187
};
188
189
portalRef = ref => {
0 commit comments