title: React parent component check if child will render
body: <p>I have a child component that depending on some of its props will end up rendering something or not. The render function of the children looks something like this:</p>
  
  <pre><code>render() {
    if (props.a == 'foo' &amp;&amp; props.b == 'bar') {
      return (&lt;p&gt; Hey There &lt;/p&gt;);
    } else if {props.a == 'z') {
      return (&lt;p&gt; Hey There &lt;/p&gt;);
    } // more conditions
    } else {
      return null
    }
  }
  </code></pre>
  
  <p>In the parent component I am rendering several child components, and I need to know how many of them will render, because depending on that number I will do something or not. I don't want to repeat the conditional logic from the child to the parent, but I don't know how from a parent I can find out if the children will render or not.</p>