React MovieDB API - Fetching data from an API

preview_player
Показать описание
This is part 3 of the React MovieDB API series. In this video I go over how to fetch the movie data from the moviedb api.

===============================================
DISCLAIMER: This video and description contains affiliate links. This helps support the channel and allows me to continue to make videos like this. Thank you for the support!
Рекомендации по теме
Комментарии
Автор

For anyone having an issue with the [...data.results] after adding the Api Key in the .env file restart the app.

Also keep in mind that with create-react-app, you need to prefix REACT_APP_ to the variable name to be able to access it.

MrLukezorz
Автор

for those of you getting an error saying its not iterable, I was getting the same error and this is how I was able to fix MY error. I hope this helps someone.
make sure you add your api key to an .env file
example:

then go to app.js and put the api key inside the state and add process.env
Here is the example.

class App extends Component {
constructor() {
super()
this.state = {
movies:[],
searchTerm: '',
apiKey:
process.env.REACT_APP_API
}
this.apiKey = process.env.REACT_APP_API
}

then i added the apiKey to the fetch the same way it was on the video. make sure you add state

marleneguzman
Автор

Muito bom. Demonstrando como criar os components com react e materializecss. Good.

douglasabnovato
Автор

In fetch when u setState, what is results?

urosrakic
Автор

How do you stop the form from accepting single characters as searchTerm and only when the enter key is pressed? I.e. instead of accepting "b, ba, bab, babe" as searchTerm, but "babe"?

itsonlyher
Автор

Do you have any Repositorie to find the code?

DheiGxux
Автор

i followed this and the fetching didnt work for me- so sad! :(

SC-ugwo
Автор

[...data.results] is not showing the data, its giving error, ...data.results is not iterable

anitadhikari
Автор

hello, thanks for your video tutorial. I followed but when I'm searching spiderman and enter, I got the error

cardramanew
join shbcf.ru