[Vuejs]-Vue render does not work when return string

2👍

The first parameter in the render function h which is nothing but a function usually called createElement which contains information describing to Vue what kind of node it should render on the page.

This createElement takes 3 arguments:

  1. The HTML tag name. This is required.
  2. An object contains the attributes you pass in normal template. This is optional.
  3. Children nodes as an array or a simple text node as a string. This is optional.

You did not return the h function ,since the first argument is required and not provided in your first snippet of code, it did not work.

Reference – Render functions

To make your first snippet of code to work you to return the h function with the 1st argument any tag name like you are doing in the second snippet.

Leave a comment