Wednesday, April 17

Tag: vue render method

CSS Tricks

What does the ‘h’ stand for in Vue’s render method?

  If you’ve been working with Vue for a while, you may have come across this way of rendering your app — this is the default in the latest version of the CLI, in main.js: new Vue({ render: h => h(App) }).$mount('#app') Or, if you’re using a render function, possibly to take advantage of JSX: Vue.component('jsx-example', { render (h) { return <div id="foo">bar</div> } }) You may be wondering, what does that h do? What does it stand for? The h stands for hyperscript. It’s a riff of HTML, which means Hypertext Markup Language: since we’re dealing with a script, it’s become convention in virtual DOM implementations to use this substitution. This definition is also addressed in the documentation of other frameworks as well. Here it is, for example, in Cy...