0

I have my constructor like below:

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);
  }

Then I have:

this.simpleStorageInstance.set(result[0].hash, { from: this.state.account}).then((r) => {
    return this.setState({ipfsHash: result[0].hash })
    console.log('ipfsHash', this.state.ipfsHash)  
})

console reads:

Uncaught TypeError: Cannot read property 'set' of undefined.

What am I doing wrong?

Moshe Slavin
  • 5,127
  • 5
  • 23
  • 38
droiddev
  • 23
  • 5

1 Answers1

-1

Considering that the only set call in your code happens on this.simpleStorageInstance and assignment to this.simpleStorageInstance is nowhere to be found in you constructor's code, I would say you forgot to properly set this property's value.

Mateusz Kocz
  • 4,492
  • 1
  • 25
  • 27