title: React.js: How to define a default property function?
body: <p>My component uses a function to render some inner text. I'd like to allow the owner of my component to provide a custom function as a property. If no custom property is provided, the component will use it's own default function. So naturally, I turned to <code>getDefaultProps</code> like so:</p>
  
  <pre><code>propTypes: function() {       
    renderText: React.PropTypes.func
  };
  
  getDefaultProps: function() {
    return {
      renderText: this._renderText
    };
  }
  </code></pre>
  
  <p>The problem is that <code>_renderText</code> is <code>undefined</code> when <code>getDefaultProps</code> is called.
  I can get around this by checking if <code>this.props.renderText</code> is defined and falling back to <code>this._renderText</code> if needed. But his doesn't feel like the React way of doing things.</p>