如何访问此结构中子项内的元素?
class MyDictionary extends React.Component {
render() {
var _this = this;
var children = this.props.results.map((result, index) =>
React.createElement(
"div",
{ className: "col-sm-12" },
React.createElement(SomeOtherClass, {
key: result.id,
name: result.name,
index: result.index,
activity: _this.props.index + 1, // using _this
images: _this.props.image_labels // using _this
})
)
);
return React.createElement("div", null, children);
}
}
return MyDictionary;
console.log(MyDictionary.children.image_labels);
当我尝试console.log(MyDictionary.children.image_labels);
时,我什么都没有回来......我已经尝试过多种方式来做这件事,但没有运气。任何建议/指导将不胜感激。