export default CategoryBrowser; This shows how to fetch data on the server and pass it to the component. Phison Ps225107ps2307 Mptool Install You Are Looking
A simulated service to fetch data. In a real app, this would query a database. Phim Indiana Jones 1 Thuyet Minh Updated Info
// components/CategoryBrowser.tsx import React, useState, useEffect from 'react'; import Media, Category from '../types/media'; import MediaService from '../services/mediaService';
export type MediaType = 'MOVIE' | 'TV_SHOW';
// services/mediaService.ts import Media, Category, CategorySlug from '../types/media';
getMediaByCategory: async (slug: CategorySlug): Promise<Media[]> => return allMedia.filter(m => m.categories.includes(slug)); ,
getAllMedia: async (): Promise<Media[]> => return allMedia; ; This component renders the category navigation and the grid of items.
export interface Category id: string; name: string; slug: CategorySlug; description: string;