Skip to content

Instantly share code, notes, and snippets.

@huhn511 huhn511/App.js
Created Jun 30, 2018

Embed
What would you like to do?
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import SendButton from './components/SendButton'
import IOTA from 'iota.lib.js'
class App extends Component {
constructor(props) {
super(props)
// Create IOTA instance directly with provider
var iota = new IOTA({
'provider': 'https://nodes.devnet.thetangle.org:443'
});
console.log("iota", iota)
this.state = {iota: iota}
iota.api.getNodeInfo(function(error, success) {
if (error) {
console.error(error);
} else {
console.log(success);
}
});
}
render() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h1 className="App-title">Welcome to React</h1>
</header>
<SendButton iota={this.state.iota}/>
</div>
);
}
}
export default App;
import React, { Component } from 'react';
class SendButton extends Component {
constructor(props){
super(props);
console.log("iota from SendButton Component", this.props.iota);
}
send() {
console.log("Send!");
console.log("Send", this.props.iota);
}
render() {
return (
<button onClick={this.send.bind(this)}>Send Transaction</button>
);
}
}
export default SendButton;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.