Correct problem with "findDOMNode" is null
authorymh <ymh.work@gmail.com>
Tue, 28 Aug 2018 18:52:12 +0200
changeset 149 298d0373812e
parent 148 fcce52a159bc
child 150 97536386b397
Correct problem with "findDOMNode" is null
client/src/components/NavbarGroup.js
client/src/components/NavbarLogin.js
--- a/client/src/components/NavbarGroup.js	Tue Aug 28 16:57:31 2018 +0200
+++ b/client/src/components/NavbarGroup.js	Tue Aug 28 18:52:12 2018 +0200
@@ -16,7 +16,8 @@
   }
 
   handleClickOutside = (e) => {
-    if(!ReactDOM.findDOMNode(this).contains(e.target)) {
+    const currentNode = ReactDOM.findDOMNode(this);
+    if(currentNode && !currentNode.contains(e.target)) {
       this.hideDropDown();
     }
   }
--- a/client/src/components/NavbarLogin.js	Tue Aug 28 16:57:31 2018 +0200
+++ b/client/src/components/NavbarLogin.js	Tue Aug 28 18:52:12 2018 +0200
@@ -16,7 +16,8 @@
   }
 
   handleClickOutside = (e) => {
-    if(!ReactDOM.findDOMNode(this).contains(e.target)) {
+    const currentNode = ReactDOM.findDOMNode(this);
+    if(!currentNode.contains(e.target)) {
       this.hideDropDown();
     }
   }