reactjs - 没有构建 KeysToComponentMap 的动态组件引用?
问题描述
我认为答案是否定的,但希望是永恒的?
var TabComponent = React.createElement(Dashboard, {});
return TabComponent;
Dashboard 是否可以被变量 tabName="Dashboard" 替换,而无需使用键:值对构建对象并使用
return React.createElement(
KeysToComponentMap[config.component]
解决方案?
解决方案
推荐阅读
- python - 如何以特定顺序将元素附加到 div?
- html - 所有 div 具有相同的属性,当悬停时,其中一个不会将其边框半径更改为 50%
- tensorflow - 模块“h5py”没有属性“文件”
- android - 水平滚动打破表格布局
- ios - 具有自动高度和自动布局的 UITableViewCell
- visual-studio-2019 - 如何在 Visual Studio 2019 中清除“管理扩展”窗口的搜索历史记录
- javascript - TypeScript – Visual Studio Code – 编译后不输出 2 个空格选项卡
- javascript - if 语句否定的区别
- arm - 将样本闪烁到 stm32 时,目标未停止错误
- javascript - 在 Next.js 中渲染动态组件最实用的方法是什么?