Skip to content

Instantly share code, notes, and snippets.

@productioncoder
Created December 10, 2018 07:21
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/7fefca71aaa6ab3983a647f78d7ea623 to your computer and use it in GitHub Desktop.
Save productioncoder/7fefca71aaa6ab3983a647f78d7ea623 to your computer and use it in GitHub Desktop.
Youtube in React: adding local state to video info Box
export class VideoInfoBox extends React.Component {
constructor(props) {
super(props);
this.state = {
collapsed: true,
};
}
render() {
/* ... */
}
onToggleCollapseButtonClick = () => {
this.setState((prevState) => {
return {
collapsed: !prevState.collapsed
};
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment