Framework/React

[React.js] Warning: validateDOMNesting(...): <tr> cannot appear as a child of <table> ์—๋Ÿฌ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•

yuri lee 2023. 8. 18. 18:10
๋ฐ˜์‘ํ˜•

Intro

์•ˆ๋…•ํ•˜์„ธ์š”.  ๋ฆฌ์•กํŠธ๋ฅผ ์‚ฌ์šฉํ•˜๋˜ ๋„์ค‘ Warning: validateDOMNesting(...): <tr> cannot appear as a child of <table> ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค. 

 

How to solve the problem

์ฝ”๋“œ๋ฅผ ์‚ดํŽด๋ณด๋‹ˆ tbody ํƒœ๊ทธ๊ฐ€ ์—†์—ˆ์Šต๋‹ˆ๋‹ค.  ์•„๋ž˜์˜ ์ฝ”๋“œ๋กœ ์ˆ˜์ •ํ•œ ๊ฒฐ๊ณผ ์—๋Ÿฌ๊ฐ€ ๋”์ด์ƒ ๋ฐœ์ƒํ•˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.

<table>
    <tbody>
        <tr><td></td></tr>
    </tbody>
</table>

 

๋ฐ˜์‘ํ˜•