My goal is to build a test suite to visualize the differences of implementation of the inner hyperscript method createElement()
(otherwise known as h()
) within React, preact, Inferno, Snabbdom, Vue..
In React, i can invoke it like that (without building a component) :
ReactDOM.render(
React.createElement('div', { className: 'preview' }, ['Hello World']),
document.getElementById('react-preview')
)
In Preact, we simply do :
preact.render(
preact.h('div', { className: 'preview' }, ['Hello World']),
document.getElementById('preact-preview')
)
With Inferno.. i must import inferno and inferno-hyperscript :
Inferno.render(
Inferno.h('div', { className: 'preview' }, ['Hello World']),
document.getElementById('inferno-preview')
)
Now, i'm still trying to figure how to do this in Vue without creating a component : i don't want to deal with the additional cost of components instances creation, i just want to visualize and compare the raw virtual dom creation and rendering process of each library.
I have found a way to do it in this post, but it still create a new Vue instance..
new Vue({
render: h => h('div', { className: 'preview' }, ['Hello World'])
}).$mount('#vue-preview')