title: React change tab on changing the state
body: <p>I'm trying to change the defaultActiveKey attribute of Tab in antd when click in other component.
  Below is the code to get active key and set tab.</p>
  <pre><code>import { Tabs } from &quot;antd&quot;;
  
  import React from &quot;react&quot;;
  const tabActiveContext = React.createContext({
    **setActivetab: (at) =&gt; {
    }**
  });
  
  class CustomTab extends React.Component {
    constructor(props) {
      super(props);
      this.state = {
        children:props.children,
        otherProps:props.otherProps,
        activetabkey: '1',
      };
      this.setActivetab = this.setActivetab.bind(this);
    }
    setActivetab() {
      this.setState({ activetabkey:'3' });
    }
    render() {
      **const { children, otherProps, activetabkey } = this.state;
      console.log(activetabkey)**;
      return (
            &lt;div className=&quot;card-container&quot;&gt;
              &lt;Tabs
                centered
                **defaultActiveKey={activetabkey}**
                type=&quot;card&quot;
                size={&quot;small&quot;}
                {...otherProps}
                tabBarStyle={{ marginBottom: 2 }}
              &gt;
                {children}
              &lt;/Tabs&gt;
            &lt;/div&gt;
          );
    }
  
  export default CustomTab;
  export { tabActiveContext };
  
  </code></pre>
  <p>Below is the code to click on component and call to change using context.</p>
  <pre><code> let { setActivetab } = useContext(tabActiveContext);
    const handleClickThumbnail = () =&gt; {
      setActivetab(&quot;3&quot;);
    };
  </code></pre>
  <p>I dont know how to bind context in class to change the state.
  Little help would be appreciated.
  In addition, I want to know the best way to change tab when I click on anything in other component. I've no idea about sharing state when there are some other props in that class from App component other than state. On the other, hand I've no idea how to bind context method in class constructor.</p>