Morgan Allen Morgan Allen - 7 months ago 31
React JSX Question

React: Calling methods inside a variable

I'm trying to run a simple React component and not sure why this isn't working.

For some reason,

isn't running. Can someone explain why?

var CreateRows = React.createClass({
addRows : function(){
return (


render: function(){
return (


You have to call the function with { this.addRows() }. With your code you are only referring to the function but not invoking it. Such a statement could be used for defining a function e.g. like onClick={ this.addRows }