Vue render functions and h(): build components in code

8 steps · about 2 h 33 min · Intermediate

  1. Render functions in Vue (article, DEV Community (Jakub Andrzejewski), 10 min)

    A short overview of what render functions are and when they beat templates, so you know the goal before the syntax.

  2. A Better Way To Create Templates In Vue.js? Render Functions Explained (video, YouTube, 15 min)

    A video walkthrough of the idea. It is older and uses Vue 2 style, so treat it as concept only and use the later steps for Vue 3 syntax.

  3. Vue 3 Explained: Rendering 101 (article, Ahmed Nasser, 15 min)

    Explains vnodes and h() as hyperscript, then rewrites a template component as a setup() render function.

  4. Render Functions & JSX (guide, Vue.js official docs, 40 min)

    The official guide to h() arguments, props, events, declaring render functions and common recipes.

  5. Render Function APIs (reference, Vue.js official docs, 25 min)

    The full h() signature plus mergeProps, withDirectives and the other helpers, once you have the basics.

  6. withDirectives can only be used inside render functions (Discussion #9622) (article, vuejs/core on GitHub, 8 min)

    Shows a common mistake, calling render helpers outside a render function, and the fix.

  7. vue3 storybook custom render (repo, ReactiveCoderHK on GitHub, 20 min)

    A practical repo that renders the same component with JSX, h() and templates, so you can compare the styles.

  8. Render function API change (RFC 0008) (article, vuejs/rfcs on GitHub, 20 min)

    The design reasoning for why h() is imported globally in Vue 3 and why setup() is preferred. Read it last.