Finally. I found out there is maximum one root node in render function in React JS. Better to wrap it with a div.
Is there any required div wrapper inside a React component
https://stackoverflow.com/questions/22110212
Question
I create a menu using React JS:
var Dropdown = React.createClass({
render: function() {
return (
<Title />
<OptionsDropdown />
);
}
});
where Title and OptionsDropdown are other React classes. The problem is this code has error until I wrap them around a div like :
var Dropdown = React.createClass({
render: function() {
return (
<div class="something">
<Title />
<OptionsDropdown />
</div>
);
}
});
Is there anyway better to handle this situation when I want no div is wrapped outside Title and OptionsDropdown.
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow