How To Fix The "REACT ERROR Th Cannot Appear As A Child Of Thead ...
Có thể bạn quan tâm
Sometimes, we may encounter the "REACT ERROR th cannot appear as a child of thead. See (unknown) > thead > th" error when developing React apps.
In this article, we’ll look at how to fix the "REACT ERROR th cannot appear as a child of thead. See (unknown) > thead > th" error when developing React apps.
Fix the "REACT ERROR th cannot appear as a child of thead. See (unknown) > thead > th" Error When Developing React Apps
To fix the "REACT ERROR th cannot appear as a child of thead. See (unknown) > thead > th" error when developing React apps, we should make sure that the direct child elements of the table element is a either thead or tr element.
For instance, we write:
import React from "react"; export default function App() { return ( <table> <thead> <tr> <th>name</th> <th>age</th> </tr> </thead> <tbody> <tr> <td>john</td> <td>33</td> </tr> <tr> <td>smith</td> <td>22</td> </tr> <tr> <td>jane</td> <td>24</td> </tr> </tbody> </table> ); }to render a table with the proper headings and rows.
We only put tr elements in the tbody elements.
Conclusion
To fix the "REACT ERROR th cannot appear as a child of thead. See (unknown) > thead > th" error when developing React apps, we should make sure that the direct child elements of the table element is a either thead or tr element.
Từ khóa » Html Cannot Appear As A Child Of Div
-
ValidateDOMNesting(...):
Cannot Appear As A Child Of ValidateDOMNesting(...):
Cannot Appear As A Child Of ValidateDOMNesting(...):
Cannot Appear As A Child Of - DtutoHow Can I Solve This Problem In My Jsx?, "Cannot Appear As A Child ...
23 - Warning: ValidateDOMNesting(...):cannot Appear As A Child
React DOM Elements Should Be Nested Properly - Rule | DeepScan
ValidateDOMNesting(...):