preact-hyperscript
preact-hyperscript copied to clipboard
Pass single node in place of children?
Right now it seems I need to wrap a node in array in order to pass it:
// works
div({className: 'new-style'}, [node])
// does not work!
div({className: 'new-style'}, node)
The second version, however, would look cleaner.
Would it be possible to make it work here?
I have also tried to use https://github.com/ohanhi/hyperscript-helpers that aim to provide this functionality:
- children is a hyperscript node, an array of hyperscript nodes, a string or an array of strings.
I have been trying to rewrite the official FB example from https://facebook.github.io/react/docs/composition-vs-inheritance.html
simplified as http://codepen.io/dmitriz/pen/dWOmjv?editors=0011
into http://codepen.io/dmitriz/pen/YVpaLV?editors=0010
However, I still have to write the verbose
div({className: 'SplitPane-left'}, [left]),
where I would much more prefer to drop the cluttering array brackets:
div({className: 'SplitPane-left'}, left),