Skip to content

Instantly share code, notes, and snippets.

@Chanutg
Last active April 15, 2019 08:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Chanutg/d7f56ecf0c79767df0ce81a99ca8fde4 to your computer and use it in GitHub Desktop.
Save Chanutg/d7f56ecf0c79767df0ce81a99ca8fde4 to your computer and use it in GitHub Desktop.
import React from "react";
class HelloWorld extends React.Component {
state = { sentence: null };
componentDidMount() {
const { drizzle, drizzleState } = this.props;
const helloWorld = drizzle.contracts.HelloWorld;
const sentence = helloWorld.methods["saySomething"].cacheCall({ from: drizzleState.accounts[0], gas:3000000});
this.setState({ sentence });
}
render() {
const { HelloWorld } = this.props.drizzleState.contracts;
console.log(this.state.sentence);
return (
<div>
<p>Sentence : {HelloWorld.saySomething[this.state.sentence] && HelloWorld.saySomething[this.state.sentence].value}</p>
</div>
);
}
}
export default HelloWorld;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment