-
Notifications
You must be signed in to change notification settings - Fork 75
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
Hyperscript! #62
Comments
IMHO this should only be an extension or plugin (same with |
Just my 2 cents:
|
Just having createElement aliased to h, like Preact has, would be a big convenience improvement already. |
@mcjazzyfunky These seem like interesting design ideas but I think it’s more important to follow a spec if there is one. @nykula If that’s all hyperscript is then you can do this today 😇: import { createElement as h } from "@bikeshaving/crank"; |
For anyone wanting to take h() up, here are some test cases and the simplest initial code to get you started, public domain 😉 Handles only the class names and optional second argument, letting you skip the boring stuff and jump right away to the cool cases @mcjazzyfunky mentioned. @brainkim Sure, aliasing the import on my side is what I do now, but having to type less in every project is quite a win (: There's just no benefit in a long name for the one function which is called hundreds times more often than any other export, unless cloning React API is on the roadmap. Same goes for |
Some addtional 2 cents of mine if you do not mind:
Anyway, for all of you who still think that hyperscript is a great thing to use: https://codesandbox.io/s/blissful-heyrovsky-h51y2?file=/src/index.js [EDIT]: Here's a little parser for standard hyperscript expressions (supporting tagName, id and classes): https://jsbin.com/qerovuvelu/1/edit?js,output |
Someone asked on reddit if we’re going to support hyperscript. I think we could definitely do this and promote it as an alternative to JSX/whatever. The only concern I have is that hyperscript typically has special stuff where they use the CSS syntax to specify id/classes in the tag (
h("a#my-link", props, children)
)? Do we need to implement this to be hyperscript compatible?The text was updated successfully, but these errors were encountered: