title: Sanitize HTML String without using dangerouslySetInnerHTML for length check
body: <p>Can I sanitize string without using dangerouslySetInnerHTML in React JSX. Requirement is to check the length of sanitized html string and then only include the component. Something like </p>
  
  <pre><code>    var SomeComponent = React.createClass({
         render:function(){
           return (
              {this.props.htmlString.length &gt; 0 ? &lt;Child htmlString={this.props.htmlString} : null}
           )
         }
      })
  
  var Child = React.createClass({
      render:function(){
        return (
          &lt;p dangerouslySetInnerHTML={{__html: this.props.htmlString}}&gt;&lt;/p&gt;
        )
      }
  })
  </code></pre>
  
  <p>Everything works fine but fails when <code>this.props.htmlString='&amp;nbsp'</code> . In this case length > 0 and component gets included. So I want to check the length of innerHTML before the element inclusion itself.</p>
  
  <p>One Possible Solution I came across is something like : </p>
  
  <pre><code>var html = "&amp;nbsp;";
  var div = document.createElement('div');
  div.innerHTML = html; //check the length of innerHTML now
  </code></pre>
  
  <p>But I am looking for a cleaner one more of react type.</p>