How do I call the function for getClass
for the className
inside this example? The way I have it written out does not seem to call getClass
.
var CreateList = React.createClass({
getClass: function() {
//some code to return className
},
render: function() {
return(
<div className{this.getClass}>Example</div>
);
}
});
You're referencing the instance of the getClass()
function as opposed to calling the function. Try tweaking it like so:
render: function() {
return(
<div className={this.getClass()}>Example</div>
);
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments