What is a render function?

Posted by Jennifer | Updated on

Render function is a normal function which receives a createElement method as it’s first argument used to create virtual nodes. Internally Vue.js’ templates actually compile down to render functions at build time. Hence templates are just syntactic sugar of render functions.

Let’s take an example of simple Div markup and corresponding render function. The HTML markup can be written in template tag as below:

and the compiled down or explicit render function would appear as below:

Note: The react components are built with render functions in JSX.

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers