Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.