• +91 9723535972
  • info@interviewmaterial.com

Vue JS Interview Questions and Answers

Question - What are functional components?

Answer -

The functional components are just simple functions to create simple components just by passing a context. Every functional component follows two rules,

Stateless: It doesn’t keep any state by itself
Instanceless: It has no instance, thus no this
You need to define functional: true to make it functional. Let's take an example of functional components,

Vue.component('my-component', {
  functional: true,
  // Props are optional
  props: {
    // ...
  },
  // To compensate for the lack of an instance,
  // we are now provided a 2nd context argument.
  render: function (createElement, context) {
    // ...
  }
})

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners