Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Youtube in React: wiring Home component up with video categories
/*....*/
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
You can’t perform that action at this time.