You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classSwitcherextendsReact.Component{constructor(props){super(props);this.state={name: 'React in patterns'};}render(){return(<buttononClick={this.onButtonClick}>
click me
</button>);}onButtonClick=()=>{console.log(`Button is clicked inside ${this.state.name}`);}}
Let me know if you accept the PR.
The text was updated successfully, but these errors were encountered:
classSwitcherextendsReact.Component{state={name: 'React in patterns'}render(){return(<buttononClick={this._buttonClick}>
click me
</button>)}handleButtonClick=()=>{console.log(`Button is clicked inside ${this.state.name}`)}}
Based on the description. If project owners are ok enable Stage 2 Babel transformation it is a good alternative to
bind
in the constructor.Let me know if you accept the PR.
The text was updated successfully, but these errors were encountered: