#You can have client components in a

1 messages · Page 1 of 1 (latest)

rough hornet
#

Do you think this is a bad approach? This is a server component, fetches data dynamically and then passes it to logicless Grid component that is a client component


export async function MovieGrid({
  fetchType,
}: {
  fetchType: fetchType;
}) {
  let response;
  switch (fetchType) {
    case "trending":
      response = await getTrendingMovies({ timeWindow: "week" });
      break;
    case "recommendations":
      response = await getRecommedations({movieId})
      break;
    case "new":
      response = await getNewMovies();
      break;
  }

  return <Grid movies={response.results} /> //grid is a client component
}```