title: Function listed for the onClick event is firing at load time on ReactJS
body: <p>I have a component that is receiving a list of records as a prop. I'm trying to add a function to an onClick event, but the code set to be executed on the click event is firing as soon as the component loads. In this case I'm referring to the processM function. I'm new to ReactJS and I would appreciate any help.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var TempJobTaskActions = React.createClass({
   processM: function(url){
  
    console.log('in processMove: ', url);
  
    $.ajax({
     type: 'GET',
     url: url,
     success: function(data){
     }
    });
  
   },
   render: function(){
  
    var action = null;
    var downUrl = '../MoveDown?id='+this.props.tid;
    var upUrl = '../MoveUp?id='+this.props.tid;
  
    if(this.props.position == "solo"){
     action = (&lt;span&gt;&lt;/span&gt;);
    }
  
    if(this.props.position == "first"){
     action = (&lt;span&gt;&lt;a className='cdc-link cdc-icon glyphicon glyphicon-arrow-down' 
      href='#' onClick={this.processM(downUrl)} title='Move Down'&gt;&lt;/a&gt;&lt;/span&gt;);
    }
  
    if(this.props.position == "last"){
     action = (&lt;span&gt;&lt;a className='cdc-link cdc-icon glyphicon glyphicon-arrow-up' 
      href='#' onClick={this.processM(upUrl)} title='Move Up'&gt;&lt;/a&gt;&lt;/span&gt;);
    }
  
    if(this.props.position == "middle"){
     action = (
      &lt;div&gt;
       &lt;span&gt;&lt;a className='cdc-link cdc-icon glyphicon glyphicon-arrow-up' 
        href='#' onClick={this.processM(upUrl)} title='Move Up'&gt;&lt;/a&gt;&lt;/span&gt;
       &lt;span&gt;&lt;a className='cdc-link cdc-icon glyphicon glyphicon-arrow-down' 
        href='#' onClick={this.processM(downUrl)} title='Move Down'&gt;&lt;/a&gt;&lt;/span&gt;
      &lt;/div&gt;
     );
    } 
  
    return (
     &lt;div&gt;{action}&lt;/div&gt;
    );
   }
  });</code></pre>
  </div>
  </div>
  </p>