function Body(props) {
  const [favPokeList, setFavPokeList] = useState([]);
  const [pokeController, setPokeController] = useState({
    /**
     * Saves the chosen element as a favourite in local Storage
     * @param {*} pokemon
     */
    savePokemon: (pokemon) => {
      // let vetor = favPokeList.slice();
      let vetor =
        localStorage.getItem("favoritesPokemons") != null
          ? JSON.parse(localStorage.getItem("favoritesPokemons")).list
          : [];
      vetor.push(pokemon);
      setFavPokeList(vetor);
      localStorage.setItem(
        "favoritesPokemons",
        JSON.stringify({ list: vetor })
      ); // pode ser aqui
    },
    /**
     * Deletes untoggles o pokemon thus makes it not favourite
     * @param {*} pokemon
     */
    deletePokemon: (pokemon) => {
      // let vetor = favPokeList.filter(_pokemon => _pokemon.name != pokemon.name);
      let vetor =
        localStorage.getItem("favoritesPokemons") != null
          ? JSON.parse(localStorage.getItem("favoritesPokemons")).list
          : [];
      vetor = vetor.filter((_pokemon) => _pokemon.name != pokemon.name);
      setFavPokeList(vetor);
      localStorage.setItem(
        "favoritesPokemons",
        JSON.stringify({ list: vetor })
      );
    },
    /**
     * simple search function for all pokemons saved as favourites
     * @param {*} pokemon
     */
    searchPokemon: (pokemon) => {
      const vetor =
        localStorage.getItem("favoritesPokemons") != null
          ? JSON.parse(localStorage.getItem("favoritesPokemons")).list
          : [];
      for (const _pokemon of vetor) {
        if (pokemon.name == _pokemon.name) return true;
      }
      return false;
    },
  });

  useEffect(() => {
    const list =
      localStorage.getItem("favoritesPokemons") != null
        ? JSON.parse(localStorage.getItem("favoritesPokemons")).list
        : [];
    setFavPokeList(list);
  }, []);

  return (
    <div className="body">
      <FirstTable favPokeList={favPokeList} pokeController={pokeController} />
      <SecondTable favPokeList={favPokeList} pokeController={pokeController} />
    </div>
  );
}
/**
 * handles all the CRUD functions regarding the functionality of the site
 * @param {*} props
 */
handles all the CRUD functions regarding the functionality of the site
@param {*} props
handles all the CRUD functions regarding the functionality of the site @param { * } props
function Body(props) {
  const [favPokeList, setFavPokeList] = useState([]);
  const [pokeController, setPokeController] = useState({
    savePokemon: (pokemon) => {
      let vetor =
        localStorage.getItem("favoritesPokemons") != null
          ? JSON.parse(localStorage.getItem("favoritesPokemons")).list
          : [];
      vetor.push(pokemon);
      setFavPokeList(vetor);
      localStorage.setItem(
        "favoritesPokemons",
        JSON.stringify({ list: vetor })
      ); 
    },
    deletePokemon: (pokemon) => {
      let vetor =
        localStorage.getItem("favoritesPokemons") != null
          ? JSON.parse(localStorage.getItem("favoritesPokemons")).list
          : [];
      vetor = vetor.filter((_pokemon) => _pokemon.name != pokemon.name);
      setFavPokeList(vetor);
      localStorage.setItem(
        "favoritesPokemons",
        JSON.stringify({ list: vetor })
      );
    },
    searchPokemon: (pokemon) => {
      const vetor =
        localStorage.getItem("favoritesPokemons") != null
          ? JSON.parse(localStorage.getItem("favoritesPokemons")).list
          : [];
      for (const _pokemon of vetor) {
        if (pokemon.name == _pokemon.name) return true;
      }
      return false;
    },
  });
  useEffect(() => {
    const list =
      localStorage.getItem("favoritesPokemons") != null
        ? JSON.parse(localStorage.getItem("favoritesPokemons")).list
        : [];
    setFavPokeList(list);
  }, []);
  return (
    <div className="body">
      <FirstTable favPokeList={favPokeList} pokeController={pokeController} />
      <SecondTable favPokeList={favPokeList} pokeController={pokeController} />
    </div>
  );
}
function Body ( props ) { const [ favPokeList , setFavPokeList ] = useState ( [ ] ) ; const [ pokeController , setPokeController ] = useState ( { savePokemon : ( pokemon ) => { let vetor = localStorage . getItem ( "favoritesPokemons" ) != null ? JSON . parse ( localStorage . getItem ( "favoritesPokemons" ) ) . list : [ ] ; vetor . push ( pokemon ) ; setFavPokeList ( vetor ) ; localStorage . setItem ( "favoritesPokemons" , JSON . stringify ( { list : vetor } ) ) ; } , deletePokemon : ( pokemon ) => { let vetor = localStorage . getItem ( "favoritesPokemons" ) != null ? JSON . parse ( localStorage . getItem ( "favoritesPokemons" ) ) . list : [ ] ; vetor = vetor . filter ( ( _pokemon ) => _pokemon . name != pokemon . name ) ; setFavPokeList ( vetor ) ; localStorage . setItem ( "favoritesPokemons" , JSON . stringify ( { list : vetor } ) ) ; } , searchPokemon : ( pokemon ) => { const vetor = localStorage . getItem ( "favoritesPokemons" ) != null ? JSON . parse ( localStorage . getItem ( "favoritesPokemons" ) ) . list : [ ] ; for ( const _pokemon of vetor ) { if ( pokemon . name == _pokemon . name ) return true ; } return false ; } , } ) ; useEffect ( ( ) => { const list = localStorage . getItem ( "favoritesPokemons" ) != null ? JSON . parse ( localStorage . getItem ( "favoritesPokemons" ) ) . list : [ ] ; setFavPokeList ( list ) ; } , [ ] ) ; return ( < div className = "body" > < FirstTable favPokeList = { favPokeList } pokeController = { pokeController } / > < SecondTable favPokeList = { favPokeList } pokeController = { pokeController } / > < / div > ) ; }
handles all the CRUD functions regarding the functionality of the site
 @param {*} props
handles all the CRUD functions regarding the functionality of the site @param { * } props
/**
     * Saves the chosen element as a favourite in local Storage
     * @param {*} pokemon
     */ // let vetor = favPokeList.slice(); // pode ser aqui /**
     * Deletes untoggles o pokemon thus makes it not favourite
     * @param {*} pokemon
     */ // let vetor = favPokeList.filter(_pokemon => _pokemon.name != pokemon.name); /**
     * simple search function for all pokemons saved as favourites
     * @param {*} pokemon
     */