I can\'t figure out how to access a method from a parent ReactJS component within my post
route and component. Using react-router
.
This is in
Move pushToPostList={this.pushToPostList} to the App Class.
var App = React.createClass({
getInitialState: function() {
return {
myList: []
};
},
pushToPostList: function (object) {
if (object) {
var myTempPosts = this.state.myPostList;
myTempPosts.push(object);
this.setState( {myPostList: myTempPosts} );
}
},
render: function() {
return (
<div>
<RouteHandler {...this.state} pushToPostList={this.pushToPostList} />
</div>
);
}
});