There's more...

Let's complicate the code a little bit to at least have a flavor of how JSX plays with props.

Define a new component before the main Vue instance:

const myComp = {  render (h) {    return <p>{this.myProp}</p>  },  props: ['myProp']}

Let's use this component in our Vue instance and pass the msg variable via props:

new Vue({  el: '#app',  render (h) {    return <div>      <myComp myProp={this.msg}/>    </div>  },  data: {    msg: 'Hello World'  },  components: {    myComp  }})

The syntax is slightly different from an HTML template. In particular, note how props are passed and how we can use camelCase and self-closing tags.

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.