Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this.setState({name: res.data[0].username});
- this.setState({name: JSON.stringify(res.data)});
- class LeaderBoard extends React.Component {
- constructor(props) {
- super(props)
- this.state = {
- name: []
- }
- }
- componentDidMount(){
- axios.get('https://fcctop100.herokuapp.com/api/fccusers/top/recent').then(res =>
- {
- this.setState({name: res.data[0].username});
- });
- }
- render () {
- return (
- <div>
- <h1>{this.state.name}</h1>
- </div>
- )
- }
- }
- ReactDOM.render(
- <LeaderBoard/>, document.getElementById("app"));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement