import React from 'react';
import style from './pokemon-list.css';
import Pokemon from './pokemon';

class PokemonList extends React.Component {

  componentDidMount() {
  }

  render() {
    const that = this;

    const { pokemonList, onSelectPokemon } = that.props;

    const pokemonItems = [];
    pokemonList.forEach((pokemon) => {
      pokemonItems.push(<Pokemon key={pokemon.id} id={pokemon.id} url={pokemon.url} onSelectPokemon={onSelectPokemon} />);
    });

    return (
      <div className="pokemon-list">
        {pokemonItems}
      </div>
    );
  }
}

export default PokemonList;
