'use client' import { useState, useEffect } from 'react' import Game from '@/components/game' interface GameData { title: string image: string url: string } export default function Games() { const [games, setGames] = useState([]) useEffect(() => { async function fetchGames() { try { const response = await fetch('/games.json') if (!response.ok) { throw new Error('Failed to fetch data') } const data: GameData[] = await response.json() setGames(data) } catch (error) { console.error('Error fetching data:', error) } } fetchGames() }, []) return (

Games

{games.map((game, index) => (
))}
) }