title: How do I set PropTypes for Higher Order Functional Component?
body: <p>I'm using airbnb configuration for eslint and it's giving me this warning:</p>
  
  <p><code>[eslint] 'isLoading' is missing in props validation (react/prop-types)</code></p>
  
  <p>Is there a way to set PropTypes for isLoading?</p>
  
  <pre><code>const withLoading = Component =&gt; ({ isLoading, ...rest }) =&gt;
    (isLoading ? &lt;LoadingSpinner /&gt; : &lt;Component {...rest} /&gt;);
  </code></pre>
  
  <p>Here's an example of how I use it:</p>
  
  <pre><code>const Button = ({ onClick, className, children }) =&gt; (
    &lt;button onClick={onClick} className={className} type="button"&gt;
      {children}
    &lt;/button&gt;
  );
  Button.propTypes = {
    onClick: PropTypes.func.isRequired,
    className: PropTypes.string,
    children: PropTypes.node.isRequired,
  };
  Button.defaultProps = {
    onClick: () =&gt; {},
    className: '',
    children: 'Click me',
  };
  
  const Loading = () =&gt; (
    &lt;div&gt;
      &lt;p&gt;Loading...&lt;/p&gt;
    &lt;/div&gt;
  );
  
  const withLoading = Component =&gt; ({ isLoading, ...rest }) =&gt;
    (isLoading ? &lt;Loading /&gt; : &lt;Component {...rest} /&gt;);
  
  // How do I set propTypes for isLoading?
  // I tried this but it didn't work:
  // withLoading.propTypes = {
  // isLoading: PropTypes.bool
  // };
  
  const ButtonWithLoading = withLoading(Button);
  
  // The rendered component is based on this boolean.
  // isLoading === false:  &lt;Button /&gt; is rendered
  // isLoading === true:   &lt;Loading /&gt; is rendered
  const isLoading = false;
  
  ReactDOM.render(
    &lt;ButtonWithLoading
        isLoading={isLoading} 
        onClick={() =&gt; alert('hi')}
    &gt;Click Me&lt;/ButtonWithLoading&gt;,
    document.getElementById('root')
  );
  </code></pre>
  
  <p>I've also posted it to jsfiddle: <a href="http://jsfiddle.net/BernieLee/5kn2xa1j/36/" rel="noreferrer">http://jsfiddle.net/BernieLee/5kn2xa1j/36/</a></p>