On the problem of tab dynamic loading Module of react antd

about the tab dynamic loading module of react antd

the contents of Tab should be loaded dynamically upon request

the related code is as follows

/ / method
switchRoute = ({selectedKeys}) = > {

    const { dispatch, TabList } = this.props;
    dispatch(SwitchRoute(selectedKeys));
    let TabItem;
    if(selectedKeys[0]==="ResourcePlanPreserve"){
        TabItem={title: "", content:<ResourcePlanPreserve/>, key:"ResourcePlanPreserve"};
    }
    if (TabList.length) {
        if (TabList.filter(value => value.key === selectedKeys[0]).length) {
            dispatch(PublicActiveKey(selectedKeys[0]));
        } else {
            TabList.push(TabItem);
            dispatch(PublicActiveKey(TabList[TabList.length-1].key));
            dispatch(PublicTabAdd(TabList));
        }
        
    } else {
        TabList.push(TabItem);
        dispatch(PublicActiveKey(TabList[TabList.length-1].key));
        dispatch(PublicTabAdd(TabList));
    }  
};

/ / this is the main body
< Tabs

                activeKey={ActiveKey}
                onChange={this.onTabChange}
                type="editable-card"
                onEdit={this.onEdit}
                hideAdd={true}
            >
                {TabList&&TabList.map(pane => <TabPane tab={pane.title} key={pane.key} closable={pane.closable}>{pane.content}</TabPane>)}
            </Tabs>

the content of TabList must be defined as a tag before it can be inserted. Is there any good way to insert it?

Sep.16,2021
Menu