Skip to content

Instantly share code, notes, and snippets.

@productioncoder
Created November 11, 2018 13:30
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/f7fdcc386c527abd56b6a2867bc14174 to your computer and use it in GitHub Desktop.
Save productioncoder/f7fdcc386c527abd56b6a2867bc14174 to your computer and use it in GitHub Desktop.
Youtube in React: get channel id by current URL
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