I want to call a non-static method from static method. Both are in same class. How can I achieve this ?
class Home extends React.Component {
constructor(props) {
super(props);
console.log("in constructor props =", this.props.mainData);
this.state = {
data: null,
isFetch: false,
clickEvent: false
}
this.allDataShow = this.allDataShow.bind(this);
this.upcomingShow = this.upcomingShow.bind(this);
}
allDataShow(){
allData(this.props.mainData);
}
upcomingShow(){
upcoming(this.props.mainData);
}
static changeData(option) {
console.log("I'm home changeData");
switch (option) {
case "All":
console.log("All");
allDataShow();
break;
case "Upcoming":
console.log("Upcoming");
console.log("this",this);
inst.prototype.upcomingShow();
break;
}
}
render(){...}
}
This is updated code in which I am calling changeData in another component, and in changeData I call non-static method. But it doesn't work.