I have a like a scenario like this below
class Dashboard extends React.Component{
constructor(){
super();
this.state = {opens: false};
}
check(){
read(); //there is some other code which call this read function after completion
function read(){
this.callnow();
}
}
callnow() {
alert("called");
}
render(){
return (
<div>
<Button label="Check" onClick={this.check.bind(this)} />
</div>
);
}
}
on button click check function is called which call read function (this function is call back function which called after some browser activity happens) inside read function I need to call another method of Dashboard component which is callnow.
I know this can resolve using like
var self = this;
then use self inside the function.
I need to know how to use bind in this case ? I want to perform this case using bind only (just for knowledge purpose)