如何将子元素附加到React元素

时间:2018-09-22 17:51:48

标签: react-native

我正在尝试使用React将excel转换为表格。我想将孩子添加到React元素。

let html_code = React.createElement("tbody");
let head = excel.shift();

/* append th */
let html_head = React.createElement("tr");
head.forEach(function(cell_data) {
    html_head.appendChild ((React.createElement("th", null, cell_data));
});
html_code.appendChild(html_head);

我知道appendChild()不是函数。我只想知道如何追加。

0 个答案:

没有答案