In most cases, having a parent tag isn't an issue.
React.createClass({
render: function() {
return (
<tbody>
<tr><td>Item 1</td></tr>
<tr><td>Item 2</td></tr>
</tbody>
);
}
});
But there are some cases where it makes sense to have sibling elements in one render function without a parent, and especially in the case of a table, you don't want to wrap a table row in a div
.
React.createClass({
render: function() {
return (
<tr><td>Item 1</td></tr>
<tr><td>Item 2</td></tr>
);
}
});
The second example gives the following error: Adjacent XJS elements must be wrapped in an enclosing tag while parsing file
.
How can I render two sibling elements without wrapping them in a <div>
or something similar?