찾다

 >  Q&A  >  본문

javascript - [解决]Warning: validateDOMNesting(...): <tr> cannot appear as a

用React js编码时候碰到这个
Warning: validateDOMNesting(...): <tr> cannot appear as a child of <table>. See TopTen > table > tr. Add a <tbody> to your code to match the DOM tree generated by the browser.

源代码片段

render() {
    return (
        <table>
            <tr>
                <th>日期</th>
                <th>耗时</th>
                <th>错误</th>                            
                <th>备注</th>
            </tr>
        </table>
    );
}

根据提示: Add a <tbody> to your code to match the DOM tree generated by the browser.
在tr上面加一层tbody就解决了。

高洛峰高洛峰2814일 전1715

모든 응답(0)나는 대답할 것이다

답장 없음
  • 취소회신하다