Declarative Rendering in Vue.js | Vue.js Series | Part - 2
Dynamic webpages are built when we have the facility of rendering data in the form of variables in the template.
In Vue.js we can declare variables and render them inside the template.
How to declare variables in Vue.js?
The most common method of declaring variables in Vue.js is as follows (look in the script in the image below, the message variable) -
We can import these variables inside the template as follows (look in the template in the image below) -
Let us now run our app and check if the variable got rendered successfully.
So yes, the variable got rendered.
There are more ways of importing variables such as props, which we will see later on in the series.
In Part - 3 we will learn how to make components in Vue.js and import them inside pages.
If you have anything to say or add, let me know in the comment section below.