title: What is the best way of defining optional propTypes in react?
body: <p>I have an optional propType</p>
  
  <pre><code>static defaultProps = {
     onSort: undefined, // undefined | () =&gt; {}
  }
  </code></pre>
  
  <p>If undefined, we will check for <code>undefined</code> before the function is called.</p>
  
  <pre><code>_handleSort = () =&gt; {
     this.props.onSort &amp;&amp; this.props.onSort()
  }
  </code></pre>
  
  <p>So, how do I handle the propType of type <code>Function | undefined</code>. Should I check for undefined before calling the function or define a default function <code>() =&gt; {}</code></p>