-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
51 lines (42 loc) · 1.25 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import React, { Component } from 'react';
import './App.css';
import steem from 'steem'
class App extends Component {
constructor(props) {
steem.api.setOptions({ url: 'https://api.steemit.com' });
super(props);
this.state = {username: '', followers: []};
this.handleChange = this.handleChange.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
}
handleChange(event) {
this.setState({username: event.target.value});
}
handleSubmit(event) {
console.log('Submitted', this.state.username);
event.preventDefault();
steem.api.getFollowers(this.state.username, 0, 'blog', 100, (err, result) => {
console.log(result)
this.setState({ followers: result })
})
}
render() {
return (
<div className={"outer"}>
<form className={"form"} onSubmit={this.handleSubmit}>
<label>
Followers for:
<input type="text" value={this.state.username} onChange={this.handleChange} />
</label>
<input type="submit" value="Submit" />
</form>
{this.state.followers.map((user, idx) =>
<div className={'follower'} key={idx}>
{user.follower}
</div>
)}
</div>
);
}
}
export default App;