title: On closing a particular tab it closes all the tabs
body: <p>Please look into this, on closing a particular tab it closes all the tabs that are open. I want only that particular tab to be closed.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>remove = targetKey =&gt; {
    let { activeKey } = this.state;
    let lastIndex;
    this.setState(prevState =&gt; { 
        const newState = {...prevState};
        newState.forEach((pane, i) =&gt; {
            if (pane.key === targetKey) {
              lastIndex = i - 1;
            }
        });
        const panes = newState.filter(pane =&gt; pane.key !== targetKey);
        if (panes.length &amp;&amp; activeKey === targetKey) {
            if (lastIndex &gt;= 0) {
              activeKey = panes[lastIndex].key;
            } else {
              activeKey = panes[0].key;
            }
        }
        return ({panes, activeKey});
    });  
  };</code></pre>
  </div>
  </div>
  </p>
  <p>Check this link
  <a href="https://jsfiddle.net/yjumr4ox/1/" rel="nofollow noreferrer">https://jsfiddle.net/yjumr4ox/1/</a></p>