I'm new to Reactjs and making a directory browsing application with Cordova and Reactjs.
Currently I get the error this.props.onClick is not a function
, I figured out that this.props.onClick
is undefined. Check my code below:
var RepositoryList = React.createClass({
//updating the list from a child folder entry
updateListFromChild:function(childFolder){
console.log("in parent update");
},
render:function(){
console.log(this.updateListFromChild); //function()
var itemsInRepo = this.props.items.map(function(entry){
console.log("in map: " + this.updateListFromChild); //undefined
return (
<RepositoryEntry repositoryItem={entry}
folderOnClick={this.updateListFromChild} />
);
});
return (
<ul className="table-view">
{itemsInRepo}
</ul>
);
}
});
The property folderOnClick
is undefined. But I don't know how to solve this problem. Can someone point this out?