How it works...

Vue lets you create components that are very lightweight as they don't have any internal state. With this come some limitations, for example, the only place where we can put some logic to process user input (in the form of children of the element or props) is in the render function.

The context we passed contains the following properties:

  • props: This is passed by the user.
  • children: This is really an array of virtual nodes, children of our component in the template. We don't have the actual HTML element here but only a representation of it by Vue.
  • slots: This is a function returning the slots (can be used instead of children in some cases).
  • data: This is the entire data object passed to the component.
  • parent: This is a reference ...

Get Vue.js 2 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.