1
Good afternoon. I have the following code snippet:
import React,{Component} from 'react';
import './App.css';
class App extends Component {
constructor(){
super();
this.state={
pokemonList : []
}
}
componentDidMount(){
fetch("https://pokeapi.co/api/v2/pokemon")
.then(response => response.json())
.then(data => this.setState({pokemonList: data}))
}
render (){
const pokemonList = this.state;
return(
<div>
<h1>{pokemonList.map(pkmn => <div>{pkmn.name}</div>)}</h1>
</div>
)
};
}
export default App;
Which results in the error presented in the description of the question. Does anyone know the cause?