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 via h(null, null, ...args) #16

Merged
merged 8 commits into from
May 23, 2019

Conversation

ithinkihaveacat
Copy link
Contributor

How do you feel about supporting "fragments" via the form h(null, null, "foo", "bar", "baz") => foobarbaz? (Without this PR, the return value is <null>foobarbaz</null>.)

This would make it possible to use JSX's fragment short form (<>...</>) via TypeScript. It will only become easy to do once microsoft/TypeScript#20469 is fixed, but with this PR, it at least becomes possible with workaround wrapper code such as:

import h = require("vhtml");

export const React = {
  createElement: h,
  Fragment: ({ children }: { children: string[] }) => h(null, null, ...children),
};

@developit
Copy link
Owner

@ithinkihaveacat sorry for the long wait - I think Fragments should be supported.

@developit
Copy link
Owner

developit commented May 23, 2019

I PR'd a possible size optimization for this PR here: github.com/ithinkihaveacat/pull/1
Nevermind, it was smaller so I've just merged it here.

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

Successfully merging this pull request may close these issues.

2 participants