The problem is that React.Children.only expects the only child to be a valid React element, and not a displayed string or number.
I really don't understand the rationale or use case, but React 15.3.1 no less improves the error message ("React.Children.only expected to get one React child").
React issue # 1104 discusses this further.
The solution, apparently, should ignore React.Children.only and go directly to the single children element:
if (React.Children.count(children) === 1) { doSomethingWith(children); }
source share