aboutsummaryrefslogtreecommitdiffstats
path: root/app/components/Genre.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'app/components/Genre.tsx')
-rw-r--r--app/components/Genre.tsx24
1 files changed, 24 insertions, 0 deletions
diff --git a/app/components/Genre.tsx b/app/components/Genre.tsx
new file mode 100644
index 0000000..13e7ed2
--- /dev/null
+++ b/app/components/Genre.tsx
@@ -0,0 +1,24 @@
+import { useEffect, useState } from "react"
+
+const Genres = ({id}) => {
+
+ const [genres, setGenres] = useState()
+
+ useEffect(() => {
+ fetch(`https://api.themoviedb.org/3/movie/${id}?api_key=8216fbb9997cd81a67471e6cb5a6f2df`).then((res) => res.json()).then((data) => {
+ setGenres(data?.genres)
+ })
+ }, [id])
+
+ return (
+ <div className="text-white/60 gap-x-3 text-xs flex flex-row flex-wrap relative">
+ {genres?.map((genre, index) => {
+ return (
+ <div key={index}>{genre.name}</div>
+ )
+ })}
+ </div>
+ )
+}
+
+export default Genres \ No newline at end of file