Created
December 17, 2018 16:04
-
-
Save productioncoder/dc542c3389747b991f629cf157032179 to your computer and use it in GitHub Desktop.
Youtube in React: wiring Home component up with video categories
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*....*/ | |
import {getVideoCategoryIds} from '../../store/reducers/videos'; | |
/* ... */ | |
function mapStateToProps(state) { | |
return { | |
youtubeLibraryLoaded: getYoutubeLibraryLoaded(state), | |
videoCategories: getVideoCategoryIds(state), | |
}; | |
} | |
function mapDispatchToProps(dispatch) { | |
const fetchMostPopularVideos = videoActions.mostPopular.request; | |
const fetchVideoCategories = videoActions.categories.request; | |
const fetchMostPopularVideosByCategory = videoActions.mostPopularByCategory.request; | |
return bindActionCreators({fetchMostPopularVideos, fetchVideoCategories, fetchMostPopularVideosByCategory}, dispatch); | |
} | |
export default connect(mapStateToProps, mapDispatchToProps)(Home); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment