import React, { Component } from 'react';
import ReactDOM from 'react-dom';


export default class ReactNoUnmountHide extends Component {
  constructor() {
    super();
  }

  toggle(value) {
    if (value) {
      this.dom.style.display = 'none';
    } else {
      this.dom.style.display = null;
    }
  }

  componentDidMount() {
    this.dom = ReactDOM.findDOMNode(this.refs.container);

    this.toggle(this.props.value);
  }

  componentWillReceiveProps(nextProps) {
    if (nextProps.value !== void 0) {
      this.toggle(nextProps.value);
    }
  }


  render() {
    return React.cloneElement(this.props.children, { ref: 'container' });
  }
};

@@ -30,15 +30,15 @@
 rom 
-'
+%22
 react
-'
+%22
 ;%0Aim
@@ -56,17 +56,17 @@
 OM from 
-'
+%22
 react-do
@@ -66,19 +66,18 @@
 eact-dom
-';%0A
+%22;
 %0A%0Aexport
@@ -165,38 +165,56 @@
 ();%0A
+%0A
   
-%7D%0A%0A  toggle(value) %7B%0A    if 
+  this.ref = React.createRef();%0A  %7D%0A%0A  toggle
 (val
@@ -215,26 +215,24 @@
 le(value) %7B%0A
-  
     this.dom
@@ -252,71 +252,30 @@
 y = 
-'none';%0A    %7D else %7B%0A      this.dom.style.display = null;%0A    %7D
+value ? null : %22none%22;
 %0A  %7D
@@ -348,23 +348,19 @@
 .ref
-s
 .c
-ontainer
+urrent
 );%0A
-%0A
     
@@ -521,17 +521,16 @@
  %7D%0A  %7D%0A%0A
-%0A
   render
@@ -596,19 +596,16 @@
 ef: 
-'container'
+this.ref
  %7D);
@@ -610,10 +610,9 @@
 );%0A  %7D%0A%7D
-;
 %0A

Use new React ref API (needs React >= 16.3)