Skip to content

Commit 8c3a59f

Browse files
authored
replace usage of findDOMNode with creating selfRef in constructor (#3054)
* replace usage of findDOMNode with creating selfRef in constructor * deleted findDOMNode that was commented out for testing
1 parent 030b978 commit 8c3a59f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

components/modal/index.jsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@ class Modal extends React.Component {
207207
if (props.ariaHideApp) {
208208
checkAppElementIsSet();
209209
}
210+
211+
this.selfRef = React.createRef();
210212
}
211213

212214
componentDidMount() {
@@ -224,14 +226,13 @@ class Modal extends React.Component {
224226
// and manager.jsx are removed. They appear to have
225227
// been created in order to do modals in portals.
226228
if (!this.isUnmounting) {
227-
const el = ReactDOM.findDOMNode(this); // eslint-disable-line react/no-find-dom-node
228229
if (
229-
el &&
230-
el.parentNode &&
231-
el.parentNode.getAttribute('data-slds-modal')
230+
this.selfRef &&
231+
this.selfRef.parentNode &&
232+
this.selfRef.parentNode.getAttribute('data-slds-modal')
232233
) {
233-
ReactDOM.unmountComponentAtNode(el);
234-
document.body.removeChild(el);
234+
ReactDOM.unmountComponentAtNode(this.selfRef);
235+
document.body.removeChild(this.selfRef);
235236
}
236237
}
237238
}

0 commit comments

Comments
 (0)