Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Youtube in React: wiring Watch component up so it can dispatch actions
/* ... */
import {bindActionCreators} from 'redux';
import * as watchActions from '../../store/actions/watch';
import {withRouter} from 'react-router-dom';
import {connect} from 'react-redux';
import {getYoutubeLibraryLoaded} from '../../store/reducers/api';
function mapStateToProps(state) {
return {
youtubeLibraryLoaded: getYoutubeLibraryLoaded(state),
function mapDispatchToProps(dispatch) {
const fetchWatchDetails = watchActions.details.request;
return bindActionCreators({fetchWatchDetails}, dispatch);
export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Watch));
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.