Introducing properties
As you have noticed, the component we created in the previous section is static and could not be used in a real-life application because it would always display the same information and not the actual post.
In the following section, we are going to add some dynamic features to our component. To ensure each topic is understood fully, we will add a small feature in each section and ensure that we take enough time to reiterate the features over the course of the book.
In this section, we are going to change the structure of our post component by exposing properties. Properties are simply attributes that are exposed by the component to allow users to customize its behavior or style.
If you have ever used HTML, you are probably already familiar with Vue.js props. Many native HTML elements have attributes that are used to modify components, such as an <input>
tag as an attribute of Type
to change its look, a <textarea>
tag as an attribute of column...