title: React Bootstrap Expand All/Collapse All <Panel.Body> component created in map loop
body: <p>I am trying to create a <code>react-bootstrap</code> app out of nested PanelGroup components. I everything is working correctly, but now I have been asked to add an expand all / collapse all link. Since I am generating the panels through a map loop, I am not totally sure if this is possible or not. Here is what I have so far:</p>
  
  <pre><code>{data.map((item, i)=&gt;{
                  return (
                      &lt;PanelGroup key={i + 1} accordion id={(i + 1).toString() + 'accordion'}&gt;
                          &lt;Panel key={i + 1} eventKey={(i + 1).toString() }&gt;
                              &lt;Panel.Heading&gt;
                                  &lt;Panel.Title toggle&gt;
                                      {this.getHeaderNode(i, data)}
                                  &lt;/Panel.Title&gt;
                              &lt;/Panel.Heading&gt;
                              &lt;Panel.Body collapsible&gt;
                                  { this.getChildrenNode(i, data) }
                              &lt;/Panel.Body&gt;
                          &lt;/Panel&gt;
                      &lt;/PanelGroup&gt;
                  );
              })}
  </code></pre>
  
  <p>I have tried implementing some different attributes as described in the <a href="https://react-bootstrap.github.io/components/panel/" rel="nofollow noreferrer">docs here</a> </p>
  
  <p>For instance, I have added an attribute to <code>Panel.Body</code> that will listen to the state:</p>
  
  <pre><code>expanded={this.state.expanded}
  </code></pre>
  
  <p>Then, my thinking was to add a button as another component that will fire a function on click, such as:</p>
  
  <pre><code>_toggleExpand: function() {
      this.setState({expanded: !this.state.expanded});
    }
  </code></pre>
  
  <p>But, how do I get the Panels to determine whether the user clicked the collapse/expand all button, or if the user clicked on the <code>Panel.Title</code> to expand/collapse the single panel?</p>