我正在使用React-Rails应用程序,并且在控制台中不断出现此错误:
```
Warning: validateDOMNesting(...): <th> cannot appear as a child of <thead>.
See (unknown) > thead > th.
我不确定为什么这行不通..我想为表使用标头(thead),并且对其他人有用。我会把tbody放进去,但我需要桌子的实际主体。
这是此表的代码:
```
React.DOM.table
className: 'table table-bordered'
React.DOM.thead null,
React.DOM.th null, 'Description'
React.DOM.th null, 'Actions'
React.DOM.tbody null,
for post in @state.posts
React.createElement Post, key: post.id, post: post,
handleDeletePost: @deletePost
**编辑我曾尝试在thead下添加tr标签,这会导致额外的错误。这就是我将代码更改为:
```
React.DOM.table
className: 'table table-bordered'
React.DOM.thead null
React.DOM.tr null
React.DOM.th null, 'Description'
React.DOM.th null, 'Actions'
React.DOM.tbody null,
for post in @state.posts
React.createElement Post, key: post.id, post: post,
handleDeletePost: @deletePost
而我得到的下一个错误是:警告:validateDOMNesting(...):tr不能作为表的子代出现。参见(未知)>表格> tr。在您的代码中添加一个以匹配浏览器生成的DOM树。
我是新来的反应者,不熟悉coffeescript,所以我想知道这是否与间距或其他有关。测试了不同的间距,这没有帮助。我一起把thead拿出来,导致我的应用坏了,所以..不确定是什么问题
thead > tr > th