Assistance de TMDB

Hello everyone!

So, I'll try to keep this as short as possible even tho I don't know how possible it's gonna be. I'm trying to create an app that shows the 20 top rated movies and 20 upcoming movies on the front page when you open the app. Easy enough. I also have a search bar at the top where I can search for movies and get the results back. The issue is that I'm quite new to React and Frontend development in general (and programming too, I haven't really been programming too much) and I just don't know how to solve the issue I have. I also realized that I might have posted this in the wrong category first.

The issue is that, when I search for a movie, I want React to render a different component and take me to a different route, for example http://localhost:3000/searchresults/:keyword or something like that. I know how to set that up in App.js, with the routes and all that, but I just can't get it to work. Most recently, the issue is that I'm getting some sort of an error that the results I'm getting back from the API don't exist, or that they're undefined. Again, I'm not very good at this so I'm having some trouble with understanding what's wrong and what do I actually have to do to fix the issue.

If anyone could and would want to help, I'd love to hear your suggestions! I can give you the link to my GitHub repository so that you can download the code and maybe identify the issue in that way. Once again, I am very much aware that my code looks quite ugly, there's a lot of things that could and should be broken up in separate components or even some things that don't even make sense. I've been using ChatGPT to help me out with stuff and it's been quite useful so far, except that I'm stuck now and don't know how to solve this issue. Also, I'm aware that you should normally hide your API key or API Read Access Token, but I don't think I need to hide it right now.

https://github.com/IITheGameII/movie-app

Edit: Someone pointed out that I wasn't returning the res.json() in line and that's why I was getting undefined. Unfortunately, I still haven't been able to solve my entire issue with the app, showing the results in a separate component and all that, but this is a good start

Un film, une émission télévisée ou un artiste est introuvable ? Connectez-vous afin de créer une nouvelle fiche.

Général

s Mettre le curseur dans la barre de recherche
p Ouvrir le menu du profil
esc Fermer une fenêtre ouverte
? Ouvrir la fenêtre des raccourcis clavier

Sur les pages des médias

b Retour (ou vers le parent si faisable)
e Afficher la page de modification

Sur les pages des saisons des émissions télévisées

Afficher la saison suivante (flèche droite)
Afficher la saison précédente (flèche gauche)

Sur les pages des épisodes des émissions télévisées

Afficher l'épisode suivant (flèche droite)
Afficher l'épisode précédent (flèche gauche)

Sur toutes les pages des images / photos

a Ouvrir la fenêtre d'ajout d'image / photo

Sur toutes les pages de modifications

t Ouvrir le sélecteur de traduction
ctrl+ s Envoyer le formulaire

Sur les pages des discussions

n Créer une nouvelle discussion
w Basculer le statut de suivi
p Basculer publique / privée
c Basculer fermer / ouvrir
a Ouvrir l'activité
r Répondre à la discussion
l Afficher la dernière réponse
ctrl+ enter Envoyer votre message
Page suivante (flèche droite)
Page précédente (flèche gauche)

Paramètres

Vous souhaitez évaluer ou ajouter cet élément à une liste ?

Connexion