Warning: validateDOMNesting(...): Text nodes cannot appear as a child of <thead>.
index.js:1 Warning: validateDOMNesting(...): Text nodes cannot appear as a child of <tbody>.
這種情況一般是表單節點是不存在的情況,我們沒修改的時候是這樣的
<table className="table text-center">
<thead>{this.props.tableHead.length }</thead>
<tbody>{this.props.tableData.length }</tbody>
</table>
修改完是這樣的
<thead>{this.props.tableHead.length > 0 ? this.props.tableHead: <tr></tr>}</thead>
<tbody>{this.props.tableData.length > 0 ? this.props.tableData: <tr></tr>}</tbody>
找了一下午,最終還是學長來給我看出來了