View Code? Open in Web Editor
NEW
This project forked from austincodingacademy/aca-flix
Create a Netflix like movie list. Search for movies from the top search box. Click on the check box to add the movie to your list.
HTML 4.48%
CSS 43.93%
JavaScript 51.59%
aca-flix's Introduction
- Get your api key from the themoviedb.org
- Fork, Clone, yarn install, yarn start
- Create functional components as defined by comments in the jsx in App.js, such as {/* */}
- Import and use components in App.js
- Navigation.js
- UserProfile.js
- In state.js file
- Create our state object with properties
- searchResults: []
- myMovieList: []
- export state object
- In reducers/index.js
- Create reducers functions for all state
- Parameters - state, action
- Remember default value
- Import combineReducers from redux
- Combine reducers and export
- myMovieList
- Look for the action “MY_MOVIE_LIST_LOADED”
- return the value
- searchResults
- Look for the action “SEARCH_RESULTS_LOADED”
- return the value
- Create our standard store.js file
- Use redux-thunk middleware
- Import reducers
- create store and export
- import Provider and wrap App
- import store and assign to store prop
- remember to export your actions
- loadMyMovieList()
- type = “LOAD_MY_MOVIE_LIST”
- make fetch call to “/movies”
- on complete, dispatch to myMovieListLoaded(movies)
- myMovieListLoaded(movies)
- type = “MY_MOVIE_LIST_LOADED”
- value = movies
- loadSearch(searchTerm)
- searchLoaded(movies)
- type = “SEARCH_RESULTS_LOADED”
- value = make sure to assign the value of movies.results to get the array of movies from movie db
- saveMyMovie(movie)
- make fetch POST to “/movies”
- on complete dispatch to loadMyMovieList()
- removeMyMovie(id)
- make a fetch DELETE to “/movies/” + id
- on complete dispatch to loadMyMovieList()
- import connect from react-redux
- mapStateToProps
- mapDispatchToProps
- connect and export
- import SearchBox
- import action
loadSearch
- mapDispatchToProps for this action
- Determine which props to map to based on the props that are already coded into the SearchBox component
- import App
- import action
loadMyMovieList
- mapStateToProps for props
searchResults
and myMovieList
to state of the same name
- mapDisptachToProps for
loadMyMovieList
- import ListToggle
- import action
saveMyMovie
and removeMyMovie
- mapDisptachToProps for
saveMyMovie
and removeMyMovie
- Change Item.js to use ListToggleContainer instead of ListToggle
- In the constructor assign a state property with an object with key “searchTerm”, set to blank string “”
- Add onChange to the input element
- on change setState for searchTerm to the value from the input
- Switch out use of ListToggle for use of ListToggleContainer
- Add componentDidMount method and call loadMyMovieList in here.
- Switch out use of SearchBox for use of SearchBoxContainer
- Add PropTypes for searchResults and myMovieList
- Switch out use of App for AppContainer
- Base - 25
- There are no runtime errors - 15
- My Movie list shows all movies from your database - 15
- Typing into the search text box and hitting enter shows a list of movies in the search results - 15
- Click one of the search results adds that movie to My Movie list - 15
- Click one of the movies in My Movie list removes it from the list - 15
aca-flix's People
Contributors
Watchers