Skip to content

Instantly share code, notes, and snippets.

@productioncoder
Created November 4, 2018 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save productioncoder/5a4edc7db07ac808ba69e506b834ba28 to your computer and use it in GitHub Desktop.
Save productioncoder/5a4edc7db07ac808ba69e506b834ba28 to your computer and use it in GitHub Desktop.
Youtube in React: pull in video by id using a selector
/* ... */
import {getVideoById} from '../../../store/reducers/videos';
/* ... */
function mapStateToProps(state, props) {
return {
video: getVideoById(state, props.videoId)
}
}
export default connect(mapStateToProps, null)(WatchContent);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment