【发布时间】:2019-02-17 00:43:00
【问题描述】:
基于 Typescript 与 ReactJS 的项目。
这是渲染代码:
return (
<div ref={this.myRef} style={this.state.myStyle} >
{this.state.sections.map((sectionsItem: AppI.SectionI) => {
if (this.state.activeSection === sectionsItem.name) {
console.log("TEST :", sectionsItem.elements );
sectionsItem.elements.map((element: React.ReactElement<any>, index: number) => {
return <span key={index} >{element}</span>;
});
}
})}
</div>
);
在调试器中,我可以看到“元素”不是空的,但它不会在 html 中呈现。
有什么建议吗?!
【问题讨论】:
标签: reactjs typescript typescript3.0