Created
September 25, 2018 17:11
-
-
Save jonathanharrell/cf680f4c13d80faf50b7b75f80c9fd85 to your computer and use it in GitHub Desktop.
AccordionPanel Component Using Context
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
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