语法错误:在类构造函数(7:4)之外的super()
我正在尝试为以太坊d-app构建React前端,但目前收到此错误,
任何帮助都会很棒!
谢谢。
class App extends Component {
contructor(props) {
super(props);
}
const MyContract = window.web3.eth.contract
([{var reactexampleContract = web3.eth.contract([{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getSecret","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"youAwesome","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":false,"stateMutability":"nonpayable","type":"fallback"}]);
this.state = {
ContractInstance: MyContract.at ('0x77d914f8121dd1a15862e939546d969b2ddd3ee7')
}
this.querySecret = this.querySecret.bind (this);
}
querySecret () {
const { getSecret } = this.state.ContractInstance;
getSecret ((err, secret) => {
if (err) console.error ('An error occured:::::', err);
console.log ('This is our contracts secret', secret);
})