Can't call setState on a component that is not yet mounted Can't call setState on a component that is not yet mounted reactjs reactjs

Can't call setState on a component that is not yet mounted


This warning that you are getting is because you are setting a reference to clickMe method in the constructor, which is then using the setState().

constructor (props) {    super(props)    this.state = {       initial: 'state',       some: ''              }   this.clickMe = this.clickMe.bind(this);   <--- This method  } clickMe () {   this.setState({     some: 'new state'    <-- the setState reference that is causing the issue   })  }