Open coderschoolreview opened 6 years ago
My bad. This is the restyling.
Great job toggling between Now Playing and Top Rated movies by storing type
in App
'sstate
, but it'll be better if you could store the current page of each type in the state
, instead of calling this.fetchMovies(1) to get the first page every time you toggleType()
. I suggest that you save the current page of each type in another key into state
, something like:
// State structure
{
"types": {
"now_playing": {
"name": "Now Playing",
"page": 1
},
"top_rated": {
"name": "Top Rated",
"page": 1
}
},
"currentType": "now_playing"
}
Remember to keep the level high of state tree upto 3. You should keep the state tree as flat as possible.
You'll be able to finish the story User sees an error message when there is a network error. by using try
/catch
block that wrap up your async
/await
function. Try to read this document about Error handling with async/await
Hello! Thank you for submitting the first homework for CoderSchool React Class 🎉! The main focus of this assignment was to introduce you to working with an API, rendering items in a collection, and dealing with
state
andprops
.Also, thanks for creating a nice
README.md
with the checkboxes. It makes it a lot easier to understand the functionality of your app.Great ✨
App.js
. Usually it's recommended to do this is incomponentDidMount
. The official Facebook React Native example does this as well. (React and React Native have the same convention here.)MovieList
|MovieCard
. There may be another opportunity to split some logic code insideApp.js
up further into more components such asNavigationBar
fetchMovies()
and distinguish the url to fetch movies with different types and titles. Reusing code is very cool and important, keep it up!Not so great yet 🚩
Great job toggling between Now Playing and Top Rated movies by storing
type
inApp
'sstate
, but it'll be better if you could store the current page of each type in thestate
, instead of calling this.fetchMovies(1) to get the first page every time youtoggleType()
. I suggest that you save the current page of each type in another key intostate
, something like:Remember to keep the level high of state tree upto 3. You should keep the state tree as flat as possible.
You'll be able to finish the story User sees an error message when there is a network error. by using
try
/catch
block that wrap up yourasync
/await
function. Try to read this document about Error handling with async/await