const templateName = 'product-edit.panel.general-details';
const Template = TemplateLoader(templateName, true);;
const Settings = (): JSX.Element => {
const [selectedTemplate, setSelectedTemplate] = useState('product-edit.panel.general-details');
return (
<Layout
className='product-edit-page-edit-view'
siderLeft={
<NavigationTreeWrapper>
<NavigationTree selectedItem={selectedTemplate} onItemClicked={setSelectedTemplate} />
</NavigationTreeWrapper>
}
content={<Template />}
/>
);
};
export default Settings;
将数据动态传递给 HOC,这应该不在每次初始化都不应该发生的组件之外......这会导致在更新时重新渲染相同的模板