Nice piece. Instead of using the bind can you also try using Public Class Fields. They allow you to add instance properties to the class definition with the assignment operator (=).
Thanks for the suggestion.
Just so that we are on the same page, you are talking about something like this right?
class App extends Component { state = { title: 'something' } myClick=()=>{ this.setState({title: 'Title changed'}) } render() { return ( <div className="wrap"> <h2>{this.state.title}</h2> <button onClick={this.myClick}>clickme</button> </div> ) } }
It does work and I like it.
Thanks again
Welcome.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Nice piece. Instead of using the bind can you also try using Public Class Fields. They allow you to add instance properties to the class definition with the assignment operator (=).
Thanks for the suggestion.
Just so that we are on the same page, you are talking about something like this right?
It does work and I like it.
Thanks again
Welcome.