• +91 9723535972
  • info@interviewmaterial.com

Vue JS Interview Questions and Answers

Question - What is a render function?

Answer -

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,

render: function (createElement) {
  return createElement('div', {
    'class': {
      'is-rounded': this.isRounded
     }
  }, [
    createElement('p', 'Welcome to Vue render functions')
  ]);
}

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners