Skip to content

Instantly share code, notes, and snippets.

@jonathanharrell
Created September 25, 2018 17:11
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 jonathanharrell/cf680f4c13d80faf50b7b75f80c9fd85 to your computer and use it in GitHub Desktop.
Save jonathanharrell/cf680f4c13d80faf50b7b75f80c9fd85 to your computer and use it in GitHub Desktop.
AccordionPanel Component Using Context
const AccordionPanel = (props) => {
return (
<AccordionItemContext.Consumer>
{({ expanded }) => <div className={"accordion-panel " + (expanded ? 'expanded' : '')}>{props.children}</div>}
</AccordionItemContext.Consumer>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment