developit / htm

Hyperscript Tagged Markup: JSX alternative using standard tagged templates, with compiler support.
Apache License 2.0
8.67k stars 170 forks source link

Vue.js' render function support #160

Closed AmatsuyuKun closed 4 years ago

AmatsuyuKun commented 4 years ago

Hi,

Just a little feature request. Please add support for Vue.js' render functions. It is just a bit different from React/Preact which I think wouldn't be that hard to implement 😄. Having this feature would be very much appreciated!

— Jōro


UPDATE

Found a much easier way of binding htm to Vue.js render functions :ok_hand::

html.js

import htm from 'htm'

module.exports = (h) =>
    htm.bind((tag, attributes, ...children) =>
        h(tag, { attrs: attributes }, children))

main.js

import Vue from 'vue'
import html from './html'

new Vue({
    el: '#root',
    render: (h) => html(h)`<h1 id="greeting">Hi</h1>`
})

But it would still be nice to add support for Vue.js out of the box.