Created
December 10, 2018 07:21
-
-
Save productioncoder/7fefca71aaa6ab3983a647f78d7ea623 to your computer and use it in GitHub Desktop.
Youtube in React: adding local state to video info Box
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 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