Search code examples
reactjscomponentsantd

How to pass `component` into tab panel when active?


Please explain to me how to pass component into tab panel when active in antd library? Example component Productshoe

<Tabs defaultActiveKey="1">
      <TabPane tab="productshoe" key="productshoe">
          <Productshoe/>
      </TabPane>

but it makes error


Solution

  • Your key in TabPane doesn't match with the key of parent Tabs. Try to keep the key value same. And keep key values unique if you add more tabs. Reference: Link

      <Tabs defaultActiveKey="productshoe" onChange={callback}>
        <TabPane tab="Tab 1" key="productshoe">
          <Productshoe/>
        </TabPane>
      </Tabs>