Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Accordion Item Component Using Context
class AccordionItem extends React.Component {
constructor (props) {
this.toggleExpansion = () => {
this.setState({ expanded: !this.state.expanded })
this.state = {
expanded: false,
toggleExpansion: this.toggleExpansion
render () {
return (
<AccordionItemContext.Provider value={this.state}>
<div className="accordion-item">
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.