:star2: 1161 | @marmiz |http://www.freecodecamp.org/marmiz
:cookie: 323 | @x140hu4 |http://www.freecodecamp.org/x140hu4
:star2: 1162 | @marmiz |http://www.freecodecamp.org/marmiz
componentDidMount() {
var topRecent = "https://fcctop100.herokuapp.com/api/fccusers/top/recent";
axios.get(`https://fcctop100.herokuapp.com/api/fccusers/top/recent/`)
.then(function (res){
console.log(res);
}).catch(function(error){
console.log(error);
})
}
render() {
return(
<div>
<ul>
{this.state.res.map(res =>
<li key={res.username}>{res.alltime}</li>
)}
</ul>
</div>
);
// <div className="container-fluid">
// <h1> TopList </h1>
// <div id="TopList">
// </div>
// </div>
}
constructor(props)
{
super(props);
this.state={
myList:[]
};
componentDidMount()
{
console.log('did mount');
const url= "// your url";
fetch(url)
.then(response=> response.json())
.then((data)=>{
console.log(data);
this.setState({
myList: data
});
});
}
{this.state.myList.map(myfunc)};