import React, { Component } from 'react'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import { getMovieRows } from '../getMovie'; import { fetchComedyMovies } from '../store/actions/index'; class ComedyMovies extends Component { componentWillMount() { this.props.fetchComedyMovies(); } render() { let movies; // Call getMoviesRows function only when we get the data back // from the API through redux if (this.props.movies.data) { const url = `/discover/tv?api_key=${process.env.API_KEY}&with_genres=35`; movies = getMovieRows(this.props.movies.data, url); } return ( <>