score:0

Accepted answer
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/17.0.1/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/17.0.1/umd/react-dom.production.min.js"></script>
<div id="react-app"></div>

score:0

 function App() {
      const [games, setGames] = useState({});
    
      useEffect(() => {
        getGames();
    
        async function getGames() {
          const response = await fetch(
            "https://v3.football.api-sports.io/fixtures?season=2021&league=78&date=2021-12-04",
            {
              method: "GET",
              headers: {
                "x-rapidapi-host": "v3.football.api-sports.io",
                "x-apisports-key": "3914b827d25c9a793d6af1ec9c312d55",
              },
            }
          );
    
          const data = await response.json();
          setGames(data.parameters);
        }
      }, []);
    
      return (
        <div>
          <h1>Games</h1>
          <div className="games">
            {Object.keys(games).length > 0 && games.map((game, index) => (
              <div key={index}>
                <h2>{game.season}</h2>
              </div>
            ))}
          </div>
          )
        </div>
      );
    }
    
    export default App;

Related Query

More Query from same tag