Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.1 kB
1
Indexable
Never
useEffect(() => {
    setIsLoading(true);
    async function fetchData() {
      const [trending, netflixOriginal, topRated, action, comedy, horror, romance, documentaries] = await Promise.all([
        fetchMoviesHandler(requests.fetchTrending),
        fetchMoviesHandler(requests.fetchNetflixOriginals),
        fetchMoviesHandler(requests.fetchTopRated),
        fetchMoviesHandler(requests.fetchActionMovies),
        fetchMoviesHandler(requests.fetchComedyMovies),
        fetchMoviesHandler(requests.fetchHorrorMovies),
        fetchMoviesHandler(requests.fetchRomanceMovies),
        fetchMoviesHandler(requests.fetchDocumentaries)
      ]);
      setMoviesTrending(trending);
      setMoviesNetflixOriginals(netflixOriginal);
    }
    fetchData();
    setIsLoading(false);
  }, [
    fetchMoviesHandler,
    requests.fetchTrending,
    requests.fetchNetflixOriginals,
    requests.fetchTopRated,
    requests.fetchActionMovies,
    requests.fetchComedyMovies,
    requests.fetchHorrorMovies,
    requests.fetchRomanceMovies,
    requests.fetchDocumentaries,
  ]);