React平时的一些踩坑总结

  1. Warning: validateDOMNesting(...): Whitespace text nodes cannot appear as a child of . Make sure you don't have any extra whitespace between tags on each line of your source code.
<table>
    <thead>
        <tr>
                {
                    theadArr.map((item, index) => return <th key={index}>{item}</th>)
                }
        </tr>
    </thead>
    <tbody>
         {
            tbody.length > 0 ? tbody.map((item , index) => {
                return <tr key={index}><td>...<td></tr>
            })  : ''
        }
    </tbody>
</table>

改为

<table>
    <thead>
        <tr>
                {
                    theadArr.map((item, index) => return <th key={index}>{item}</th>)
                }
        </tr>
    </thead>
    <tbody>
         {
            tbody.length > 0 ? tbody.map((item , index) => {
                return <tr key={index}><td>...<td></tr>
            })  : <tr></tr> 
        }
    </tbody>

</table>

tbody中至少需要一个