<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sachith Priyashantha on Medium]]></title>
        <description><![CDATA[Stories by Sachith Priyashantha on Medium]]></description>
        <link>https://medium.com/@sachithpriyashantha?source=rss-27d98ee15dd6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*Qx9GiPBcN6M4AYTA</url>
            <title>Stories by Sachith Priyashantha on Medium</title>
            <link>https://medium.com/@sachithpriyashantha?source=rss-27d98ee15dd6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 06:13:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sachithpriyashantha/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Props vs Data in Vue.js]]></title>
            <link>https://medium.com/@sachithpriyashantha/vue-js-props-ae44a6e746e?source=rss-27d98ee15dd6------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae44a6e746e</guid>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[components]]></category>
            <category><![CDATA[vue]]></category>
            <category><![CDATA[props]]></category>
            <dc:creator><![CDATA[Sachith Priyashantha]]></dc:creator>
            <pubDate>Mon, 09 Mar 2020 19:16:11 GMT</pubDate>
            <atom:updated>2020-03-09T19:47:02.481Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*23IhwNfKdSsviNfKlJOZdg.png" /></figure><p>when you are work with vue.js framework, props are the main feature you have to know. Today I am going to discuss some features of props in vue.js framework.</p><p>Lets start…</p><h3>What is a prop in vue.js?</h3><p>Props are simply used to pass some data properties to one component from another component. Suppose you wanna pass some data to component B from component A. Here you haven’t any method to directly pass data between components.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*XbOnOkhdTTHdmzyxy-0jYQ.jpeg" /></figure><p>when looking at the figure above, you can see how this task is done. When you pass data from A to B, first you need some specific location in B to store those data. This specific location we called as a <strong>prop</strong>. After storing them, you can access that data anywhere in your component.</p><h3>What are the types of props?</h3><p>You know data has different types. If you accessing some age property it is an integer type. If you accessing some name property it is a String type. Likewise, props have different types according to data types.</p><ul><li>Number</li><li>String</li><li>Boolean</li><li>Object</li><li>Array</li><li>Function</li><li>Date</li></ul><h3>How to define and accessing props?</h3><p>Any vue component can be breakdown to three sections such as the HTML part, JavaScript part, and CSS part. So here props are defined under the JavaScript section and access them inside the HTML section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*dhF0KTEj9H2VYm01b99ilg.png" /><figcaption>Define and accessing props : FoodOrder.vue component</figcaption></figure><p>I had highlighted the above figure by two separate squares. Let’s discuss what are them.</p><p>Green square displays how to define the props. This is done under the JavaScript section. Here you should define an <strong>object</strong> called props. Then you can add your props list with their type inside that defined object. I have added two props here.</p><p>Blue square displays how to access the defined props. Vue.js has a specific method to do this task. When you wanna access these props to some specific location in the component, then add a double curly braces to that place and add your relevant prop name inside of that curly braces. These double curly braces are called <strong>mustache tags</strong>.</p><h3>Passing data to the components through props</h3><p>In the above figure, you can see two props such as “foodName” and “price”. They are defined inside of “FoodOrder.vue” component. Let’s see how to pass data to this component through props.</p><p>Here I will show you how to pass data from “App.vue” component to “FoodOrder.vue” component.</p><figure><img alt="App.vue Component" src="https://cdn-images-1.medium.com/max/530/1*fT6SXcNfSIEQFq4emHZe_Q.png" /><figcaption>App.vue component</figcaption></figure><p>The above figure displays App.vue component. As well as I highlighted some locations of the figure by two squares.</p><p>Yellow square displays how to define data that want to pass to another component. Here you should define it as a function and inside of it, you can add the relevant data properties and their values.</p><p>Blue square displays how to pass the defined data to another component. Here you can see I have defined a component called “FoodOrder” inside of blue square.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/304/1*6cqB-_EosxEhbryBxwHvYA.png" /></figure><p>Earlier I have mentioned two props names (foodName, price) which are defined from this FoodOrder component. Finally, you can bind the data properties of yellow square to mentioned props by using v-bind syntax.</p><p>After that those data properties are passed to FoodOrder component and we can access them inside of the FoodOrder component.</p><h3>Conclusion</h3><p>In this article, I have discussed about vue.js props. What is a prop, what are the types of prop, how to define and accessing props, how to pass data to the component through props are the topics I have discussed above.</p><p>By now you should know the things you need to know about props in order to be a better Vue developer.</p><p>In order to keep learning more about Vue, and to learn things as I figure them out myself, and if you have any questions about vue.js props, mentioned them below.</p><p>Enjoy your coding!</p><p>Thank you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae44a6e746e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>