Skip to content

Instantly share code, notes, and snippets.

@darksh3ll
Created October 19, 2018 11:13
Show Gist options
  • Select an option

  • Save darksh3ll/4aeb6045732205dc3f7bda491f55548b to your computer and use it in GitHub Desktop.

Select an option

Save darksh3ll/4aeb6045732205dc3f7bda491f55548b to your computer and use it in GitHub Desktop.
import React, { Component } from 'react'
const arr = [12,23,56]
class DisplayPokemon extends Component {
state = {
data:[]
}
//!Lance la function au demarrage
componentDidMount() {
this.fetchData()
}
//Récupere data
fetchData = async () => {
const data = await fetch("https://raw.githubusercontent.com/Biuni/PokemonGO-Pokedex/master/pokedex.json")
const json = await data.json();
this.setState({data:json.pokemon})
}
render () {
return (
<div>
{
this.state.data.map((x) => {
return (
<div>
<ul>
<img src={x.img} alt="#" srcset=""/>
<li>{x.name}</li>
</ul>
<button>Click</button>
</div>
)
})
}
</div>
)
}
}
export default DisplayPokemon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment