movie-explorer/src/App.tsx

34 lines
725 B
TypeScript
Raw Normal View History

2024-04-29 11:19:01 +00:00
import './App.css'
2024-05-02 20:47:28 +00:00
import { MovieWall } from './objects/movie-wall'
import { useState, useEffect } from 'react'
import tmdb from './objects/tmdb'
2024-04-29 11:19:01 +00:00
2024-05-02 20:47:28 +00:00
export type Config = {
language: string,
region: string
}
2024-04-29 11:19:01 +00:00
2024-05-02 20:47:28 +00:00
function App() {
const [config, setConfig] = useState<Config>({
language: "es",
region: "spain"
})
const [popularMovies, setPopularMovies] = useState([])
useEffect(() => { tmdb.getPopular(config, setPopularMovies) }, [])
useEffect(() => { console.log(popularMovies) }, [popularMovies])
2024-04-29 11:19:01 +00:00
return (
<>
<header>
<h1>Movie Explorer</h1>
</header>
<main>
Let's explore!
2024-05-02 20:47:28 +00:00
<MovieWall movies={popularMovies} />
2024-04-29 11:19:01 +00:00
</main>
2024-05-02 20:47:28 +00:00
2024-04-29 11:19:01 +00:00
</>
)
}
export default App