I am calling a function in my react component
<button onClick={this.createComment}>Submit Comment</button> Inside my createComment function 'this' is undefined for some reason
createComment(event) { console.log('inside createComment') console.log('event', event) console.log('this', this) event.preventDefault() } I need to call this.setState inside the createComment function. How do I get the this to be the this of the component??