Skip to content

Instantly share code, notes, and snippets.

@tbranyen
Created January 28, 2017 19:14
Show Gist options
  • Save tbranyen/a0d63a8f95e8431de943b6cffe9e0bac to your computer and use it in GitHub Desktop.
Save tbranyen/a0d63a8f95e8431de943b6cffe9e0bac to your computer and use it in GitHub Desktop.
When your web component is also a reactive component...
toggleExpanded() {
this.setState({ isExpanded: !this.state.isExpanded });
// Close siblings w/o needing a store or global container!
[...this.parentNode.children].filter(x => x !== this).forEach(row => {
row.setState({ isExpanded: false });
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment