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

Support Fragments #36

Closed
lo1tuma opened this issue Nov 29, 2017 · 4 comments
Closed

Support Fragments #36

lo1tuma opened this issue Nov 29, 2017 · 4 comments

Comments

@lo1tuma
Copy link
Contributor

lo1tuma commented Nov 29, 2017

Improved fragment support has been shipped with React 16.2.0. As there is even a special JSX syntax for fragments I thought it would be nice to also have a convenient way in react-hyperscript to create fragments.


My API proposal would be the following:

h(listOfElements)

Returns a React element.

  • listOfElements Array - An array of React elements that will be wrapped with React.Fragment.

Example:

h([
    h('li', 'first'),
    h('li', 'second'),
    h('li', 'third')
]);

This would be equivalent to:

h(React.Fragment, [
    h('li', 'first'),
    h('li', 'second'),
    h('li', 'third')
]);

I would be happy to implement this if the proposal gets accepted.

@lo1tuma
Copy link
Contributor Author

lo1tuma commented Dec 13, 2017

ping @mlmorg

@lo1tuma
Copy link
Contributor Author

lo1tuma commented Jan 9, 2018

@mlmorg Do you have any feedback?

@mlmorg
Copy link
Owner

mlmorg commented Jan 18, 2018

Sorry for the delay (holiday time)! This sounds good to me. If you're able to implement this, I would happily merge!

lo1tuma added a commit to lo1tuma/react-hyperscript that referenced this issue Jan 31, 2018
@lo1tuma
Copy link
Contributor Author

lo1tuma commented Jan 31, 2018

Thanks for the feedback @mlmorg I’ve filed a PR to implement this proposal, see #39.

@mlmorg mlmorg closed this as completed in fb4dac1 Feb 24, 2018
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

2 participants