-1
Good afternoon. I have the following code
import React,{Component} from 'react';
import './App.css';
class App extends Component {
constructor(){
super();
this.state={
pokemonList : [],
count : 0,
next : "",
previous : null
}
}
componentDidMount(){
fetch("https://pokeapi.co/api/v2/pokemon")
.then(response => response.json())
.then(data => this.setState({
pokemonList: data.results,
count: data.count,
next: data.next,
previous: data.previous
}))
}
render (){
const {pokemonList} = this.state;
let number = 1;
return(
<div className="container">
<header>
<h1>Pokédex</h1>
</header>
<h1>
{pokemonList.map(pkmn =>
<div className="jumbotron" key={pkmn.name}>
<h1 class="first">{number++}</h1>
<h1 class="second">{pkmn.name}</h1>
</div>
)}
</h1>
</div>
)
};
}
export default App;
If you look at the API, it has the values of next and Previous. I would like to know how to import all these values at once, and not just import the top twenty.
data.next
is a link?– Felipe Avelar