React MovieDB API: Creating Movie components from API data

preview_player
Показать описание
This is the fourth video of the MovieDB API series. In this video, I go over how to create components from the API data that we get back.

===============================================
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!
Рекомендации по теме
Комментарии
Автор

Esse vídeo esclareceu a relação entre os componentes. Muito bom

douglasabnovato
Автор

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.

I put the api key inside the state added 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 it to the fetch the same way it was on the video.

marleneguzman
Автор

I dont know why, but Im getting an error: Unhandled Rejection (TypeError): data.results is not iterable
For:this.setState({movies: [...data.results], totalResults: data.total_results}).
I found out where is the problem, and the problem is in the api key

elavarasannarayanan
Автор

Question! how do i import the style.css? i try to import it i get
Failed to compile
./pages/App.css 2:0
Module parse failed: Unexpected token (2:0)
You may need an appropriate loader to handle this file type.
|
> *
|
| header {

tracejr
Автор

I left comment "how really fix problems with .env (file)", but admin deleted my comment - OK...

yrasabat