title: Reactjs passing methods as props to child
body: <p>Is there a way to pass methods of current class to child class as props</p>
  
  <p>As an example;</p>
  
  <pre><code>var SignupModal = React.createClass({
  mixins: [CheckMixin],
  getInitialState: function(){
    return {
        'wizardstate': 0
    }
  },
  setWizardState: function(state){
      var that = this;
      switch (state){
          case 0:
             that.setState({'wizardstate': 0});
             break;
          case 1:
              that.setState({'wizardstate': 1});
              break;
          case 2:
              that.setState({'wizardstate': 2});
              break;
          case 3:
              that.setState({'wizardstate': 3});
              break;
          case 4:
              that.setState({'wizardstate': 4});
              break;
      }
  },
  render: function(){
      var temp;
      switch (this.state.wizardstate){
          case 0:
             temp = (&lt;SignupSetup setWizardState={this.setWizardState}/&gt;);
              break;
          case 1:
              temp = (&lt;EmailSetup /&gt;);
              break;
          case 2:
              temp = (&lt;PasswordSetup /&gt;);
              break;
          case 3:
              temp =  (&lt;UsernameSetup /&gt;);
              break;
          case 4:
              temp = (&lt;CategoriesSetup /&gt;);
              break;
      }
      return (&lt;Modal {...this.props} title="Login" animation={false}&gt;
              &lt;div className="modal-body"&gt;
                  &lt;div&gt;
                  {temp}
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/Modal&gt;)
  
  
  var SignupSetup = React.createClass({
      render: function(){
          return (&lt;Button onClick={this.props.setWizardState(1)}&gt;&lt;/Button&gt;)
      }
  });
  </code></pre>
  
  <p>I want to pass this setWizardState method of SignupModal to child SignupSetup as prop, but i get the error</p>
  
  <p><code>Uncaught Error: Invariant Violation: replaceState(...): Cannot update during an existing state transition (such as within</code>render<code>). Render methods should be a pure function of props and state.react.js:17122</code></p>