I need to set state and run a function on a onClick event. How do I accomplish this in React?
I've atttempted to put these two things in their own function, but that give me this warning below.
Warning: setState(...): Cannot update during an existing state transition (such as within
renderor another component's constructor). Render methods should be a pure function of props and state; constructor side-effects are an anti-pattern, but can be moved tocomponentWillMount.
editLink(onEditLink, link) {
  this.setState({showContent: false});
  onEditLink(link);
}
render() {
  return (
    <a onClick={this.editLink(this.props.onEditLink, this.props.link)}>Edit</a>
  )
}
 
     
     
    