Created
November 11, 2018 13:30
-
-
Save productioncoder/f7fdcc386c527abd56b6a2867bc14174 to your computer and use it in GitHub Desktop.
Youtube in React: get channel id by current URL
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
export const getChannelId = (state, location, name) => { | |
const videoId = getSearchParam(location, name); | |
const video = state.videos.byId[videoId]; | |
if (video) { | |
return video.snippet.channelId; | |
} | |
return null; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment