Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass single node in place of children? #7

Open
dmitriz opened this issue Apr 26, 2017 · 0 comments
Open

Pass single node in place of children? #7

dmitriz opened this issue Apr 26, 2017 · 0 comments

Comments

@dmitriz
Copy link

dmitriz commented Apr 26, 2017

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),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant