title: javascript: Uncaught TypeError: Cannot read property 'set' of undefined
body: <p>I have my constructor like below:</p>
  
  <pre><code>constructor(props) {
      super(props)
      this.state = { 
          ipfsHash: '', 
          web3: null, 
          buffer: null,
          account: null
      };
      this.captureFile = this.captureFile.bind(this);
      this.onSubmit = this.onSubmit.bind(this);
    }
  </code></pre>
  
  <p>Then I have:</p>
  
  <pre><code>this.simpleStorageInstance.set(result[0].hash, { from: this.state.account}).then((r) =&gt; {
      return this.setState({ipfsHash: result[0].hash })
      console.log('ipfsHash', this.state.ipfsHash)  
  })
  </code></pre>
  
  <p>console reads: </p>
  
  <pre><code>Uncaught TypeError: Cannot read property 'set' of undefined.
  </code></pre>
  
  <p>What am I doing wrong?</p>