function FirstTable(props) {
  const [pokeList, setPokeList] = useState([]);
  const [pokeListOffset, setPokeListOffset] = useState(0);

  const fetchData = async () => {
    try {
      const response = await axios.get(
        `https://pokeapi.co/api/v2/pokemon/?offset=${pokeListOffset}&limit=20`
      );
      let vetor = [];
      for (const pokemon of response.data.results) {
        const _response = await axios.get(pokemon.url);
        vetor.push(_response.data);
      }
      setPokeList(vetor);
    } catch (e) {
      console.log(e);
    }
  };

  useEffect(() => {
    // quando abre-se a pagina, rodamos o fetchData()
    fetchData();
  }, [pokeListOffset]); // referencia esta variavel (esta em observacao)

  return (
    <div className="firstTable">
      <table>
        <tr>
          <th>Name</th>
          <th>Type</th>
          <th>Weight</th>
          <th>Image</th>
          <th>Fav</th>
        </tr>
        {pokeList.length > 0 &&
          pokeList.map((pokemon) => {
            return (
              <tr>
                <td>{pokemon.name}</td>
                <td>
                  {pokemon.types.map((type) => {
                    return type.type.name + " ";
                  })}
                </td>
                <td>{pokemon.weight}</td>
                <td>
                  <img src={pokemon.sprites.front_default} />
                </td>
                <td>
                  {props.pokeController.searchPokemon(pokemon) ? (
                    <a
                      href="#"
                      onClick={() =>
                        props.pokeController.deletePokemon(pokemon)
                      }
                    >
                      Unfav
                    </a>
                  ) : (
                    <a
                      href="#"
                      onClick={() => props.pokeController.savePokemon(pokemon)}
                    >
                      Fav
                    </a>
                  )}
                </td>
              </tr>
            );
          })}
      </table>
      <div>
        <a href="#" onClick={() => setPokeListOffset(pokeListOffset + 20)}>
          Próxima
        </a>
      </div>
    </div>
  );
}
/**
 * This will display all pokemons from PokeApi in a simple HTML <table>
 * @param {*} props
 */
This will display all pokemons from PokeApi in a simple HTML 
@param {*} props
This will display all pokemons from PokeApi in a simple HTML @param { * } props
function FirstTable(props) {
  const [pokeList, setPokeList] = useState([]);
  const [pokeListOffset, setPokeListOffset] = useState(0);
  const fetchData = async () => {
    try {
      const response = await axios.get(
        `https://pokeapi.co/api/v2/pokemon/?offset=${pokeListOffset}&limit=20`
      );
      let vetor = [];
      for (const pokemon of response.data.results) {
        const _response = await axios.get(pokemon.url);
        vetor.push(_response.data);
      }
      setPokeList(vetor);
    } catch (e) {
      console.log(e);
    }
  };
  useEffect(() => {
    fetchData();
  }, [pokeListOffset]); 
  return (
    <div className="firstTable">
      <table>
        <tr>
          <th>Name</th>
          <th>Type</th>
          <th>Weight</th>
          <th>Image</th>
          <th>Fav</th>
        </tr>
        {pokeList.length > 0 &&
          pokeList.map((pokemon) => {
            return (
              <tr>
                <td>{pokemon.name}</td>
                <td>
                  {pokemon.types.map((type) => {
                    return type.type.name + " ";
                  })}
                </td>
                <td>{pokemon.weight}</td>
                <td>
                  <img src={pokemon.sprites.front_default} />
                </td>
                <td>
                  {props.pokeController.searchPokemon(pokemon) ? (
                    <a
                      href="#"
                      onClick={() =>
                        props.pokeController.deletePokemon(pokemon)
                      }
                    >
                      Unfav
                    </a>
                  ) : (
                    <a
                      href="#"
                      onClick={() => props.pokeController.savePokemon(pokemon)}
                    >
                      Fav
                    </a>
                  )}
                </td>
              </tr>
            );
          })}
      </table>
      <div>
        <a href="#" onClick={() => setPokeListOffset(pokeListOffset + 20)}>
          Próxima
        </a>
      </div>
    </div>
  );
}
function FirstTable ( props ) { const [ pokeList , setPokeList ] = useState ( [ ] ) ; const [ pokeListOffset , setPokeListOffset ] = useState ( 0 ) ; const fetchData = async ( ) => { try { const response = await axios . get ( ` ${ pokeListOffset } ` ) ; let vetor = [ ] ; for ( const pokemon of response . data . results ) { const _response = await axios . get ( pokemon . url ) ; vetor . push ( _response . data ) ; } setPokeList ( vetor ) ; } catch ( e ) { console . log ( e ) ; } } ; useEffect ( ( ) => { fetchData ( ) ; } , [ pokeListOffset ] ) ; return ( < div className = "firstTable" > < table > < tr > < th > Name < / th > < th > Type < / th > < th > Weight < / th > < th > Image < / th > < th > Fav < / th > < / tr > { pokeList . length > 0 && pokeList . map ( ( pokemon ) => { return ( < tr > < td > { pokemon . name } < / td > < td > { pokemon . types . map ( ( type ) => { return type . type . name + " " ; } ) } < / td > < td > { pokemon . weight } < / td > < td > < img src = { pokemon . sprites . front_default } / > < / td > < td > { props . pokeController . searchPokemon ( pokemon ) ? ( < a href = "#" onClick = { ( ) => props . pokeController . deletePokemon ( pokemon ) } > 
                      Unfav
                     < / a > ) : ( < a href = "#" onClick = { ( ) => props . pokeController . savePokemon ( pokemon ) } > 
                      Fav
                     < / a > ) } < / td > < / tr > ) ; } ) } < / table > < div > < a href = "#" onClick = { ( ) => setPokeListOffset ( pokeListOffset + 20 ) } > 
          Próxima
         < / a > < / div > < / div > ) ; }
This will display all pokemons from PokeApi in a simple HTML <table>
 @param {*} props
This will display all pokemons from PokeApi in a simple HTML <table > @param { * } props
// quando abre-se a pagina, rodamos o fetchData() // referencia esta variavel (esta em observacao)