November 2017
Beginner to intermediate
398 pages
8h 42m
English
JSX is a special notation used inside the JavaScript code to express HTML markup. It makes the code responsible for describing the view closer to the pure HTML syntax, while still having the full power of JavaScript available.
Here's an example of a render function written with JSX:
<script>export default { data () { return { movies: [ { title: 'Star Wars' }, { title: 'Blade Runner' }, ], } }, render (h) { const itemClass = 'movie' return <ul class='movies'> {this.movies.map(movie => <li class={ itemClass }>{ movie.title }</li> )} </ul> },}</script>
As you can see in this example, we can use any JavaScript code to compose our view. We can even use the map method of the movies ...
Read now
Unlock full access