<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Gathoni Stone</title>
    <description>The latest articles on DEV Community by Gathoni Stone (@gathonis).</description>
    <link>https://dev.to/gathonis</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F353281%2Ff095b68a-8d51-4b2a-8bdd-4215bc0f6f36.jpeg</url>
      <title>DEV Community: Gathoni Stone</title>
      <link>https://dev.to/gathonis</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gathonis"/>
    <language>en</language>
    <item>
      <title>Props in Vue.js</title>
      <dc:creator>Gathoni Stone</dc:creator>
      <pubDate>Tue, 07 Apr 2020 23:56:26 +0000</pubDate>
      <link>https://dev.to/gathonis/props-in-vue-js-3beo</link>
      <guid>https://dev.to/gathonis/props-in-vue-js-3beo</guid>
      <description>&lt;p&gt;&lt;strong&gt;&lt;em&gt;First, What even are props?&lt;/em&gt;&lt;/strong&gt;😕&lt;br&gt;
According to the official Vue.js docs:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Props are custom attributes you can register on a component. When a value is passed to a prop attribute, it becomes a property on that component instance.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This basically means that props are how we pass data between components; from parent components to child components.&lt;/p&gt;

&lt;p&gt;In this post, we're going to look at some of the concepts of Vue.js props.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Let's dive in&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GlRdr1Df--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://thumbs.gfycat.com/LividCornyEmu-small.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GlRdr1Df--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://thumbs.gfycat.com/LividCornyEmu-small.gif" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Defining Props&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
For a component to register a prop, it has to first define it in its props property.&lt;/p&gt;

&lt;p&gt;In a Vue instance,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;Vue&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;component&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;todo&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;props&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;task&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="na"&gt;template&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;&amp;lt;p&amp;gt;Pending {{ task }}&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;In a Vue component file,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;template&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Pending&lt;/span&gt; &lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="nx"&gt;task&lt;/span&gt; &lt;span class="p"&gt;}}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/template&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;script&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Todo&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;props&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;task&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/script&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Passing data using props&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Passing a static value&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For a component to use the prop, include it as you would a HTML attribute&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Todo&lt;/span&gt; &lt;span class="nx"&gt;task&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Learn about Vue.js props&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;What if you want to pass more than one prop to the component instance? Simple, append the extra props to the array.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;template&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Pending&lt;/span&gt; &lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="nx"&gt;task&lt;/span&gt; &lt;span class="p"&gt;}}&lt;/span&gt; &lt;span class="nx"&gt;at&lt;/span&gt; &lt;span class="p"&gt;{{&lt;/span&gt;&lt;span class="nx"&gt;time&lt;/span&gt;&lt;span class="p"&gt;}}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/template&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;script&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Todo&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;props&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;task&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;time&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/script&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Rendering the component&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Todo&lt;/span&gt; &lt;span class="nx"&gt;task&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Learn about Vue.js props&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;time&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;10:10 am&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Passing a dynamic value&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;template&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
     &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Todo&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;bind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nx"&gt;task&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;task&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;bind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nx"&gt;time&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;time&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="o"&gt;/&amp;gt;&lt;/span&gt; &lt;span class="c1"&gt;// &lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/template&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;script&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
               &lt;span class="na"&gt;task&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Learn about Vue.js props&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
             &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/script&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Passing an array
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;template&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Todo&lt;/span&gt; 
        &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;bind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;task.id&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; 
        &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;task in tasks&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; 
        &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;bind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nx"&gt;task&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;task.task&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; 
        &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;bind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nx"&gt;time&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;task.time&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;

    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/template&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;script&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;tasks&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;task&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Learn about Vue.js props&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;time&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;10:10am&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;task&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Go for a walk&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;time&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;06:00pm&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;task&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Sleep&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;time&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;11.00pm&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
       &lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Prop types&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
It's always a good thing to define the data types of your props. When props passed don't match the defined type, Vue complains by throwing an error in the console.&lt;br&gt;
To set prop types, you list the props as an object with the properties names as keys and types as values.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt; &lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;taskId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nx"&gt;task&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nx"&gt;time&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nx"&gt;tags&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nx"&gt;isCompleted&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Boolean&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nx"&gt;markComplete&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Function&lt;/span&gt;
     &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;To learn more about props, visit the official Vue.js documentation page &lt;a href="https://vuejs.org/v2/guide/components-props.html"&gt;Vue.js docs&lt;/a&gt;&lt;/p&gt;

</description>
      <category>vue</category>
    </item>
    <item>
      <title>My #100daysofcode challenge so far</title>
      <dc:creator>Gathoni Stone</dc:creator>
      <pubDate>Tue, 31 Mar 2020 12:14:22 +0000</pubDate>
      <link>https://dev.to/gathonis/my-100daysofcode-challenge-so-far-4nhl</link>
      <guid>https://dev.to/gathonis/my-100daysofcode-challenge-so-far-4nhl</guid>
      <description>&lt;p&gt;Hello👋&lt;br&gt;
So on 20th March 2020, I committed to doing &lt;a href="https://www.100daysofcode.com/"&gt;Alexander Kallaway's&lt;/a&gt; #100days of code challenge and let's be honest, I'm tired😫😴😂.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LkiWsBzv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.unsplash.com/photo-1502106386062-9bc912245fce%3Fixlib%3Drb-1.2.1%26ixid%3DeyJhcHBfaWQiOjEyMDd9%26auto%3Dformat%26fit%3Dcrop%26w%3D750%26q%3D80" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LkiWsBzv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.unsplash.com/photo-1502106386062-9bc912245fce%3Fixlib%3Drb-1.2.1%26ixid%3DeyJhcHBfaWQiOjEyMDd9%26auto%3Dformat%26fit%3Dcrop%26w%3D750%26q%3D80" alt="alt text" title="Photo by Milada Vigerova on Unsplash"&gt;&lt;/a&gt;&lt;br&gt;
                &lt;em&gt;Photo by Milada Vigerova on Unsplash&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I've been doing&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://giddy-mangrove-thunbergia.glitch.me/"&gt;Wikipedia Viewer&lt;/a&gt; &lt;em&gt;from freecodecamp take-home projects.&lt;/em&gt;&lt;br&gt;
&lt;a href="https://closed-luminous-neighborhood.glitch.me/"&gt;Local Weather App&lt;/a&gt; &lt;em&gt;also from freecodecamp take-home projects.&lt;/em&gt;&lt;br&gt;
&lt;a href="https://www.theodinproject.com/tracks/2"&gt;The Odin Project&lt;/a&gt; &lt;em&gt;FullStack JavaScript track&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Resources I'm finding useful&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.freecodecamp.org/"&gt;Freecodecamp&lt;/a&gt; Learn to code with free 
online courses, programming projects, and interview preparation for 
developer jobs.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.theodinproject.com/"&gt;The Odin Project&lt;/a&gt; &lt;em&gt;A web development 
website with different tracks to follow.&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.30secondsofcode.org/"&gt;30 seconds of code&lt;/a&gt; &lt;em&gt;Short JavaScript 
code snippets that can be understood in less than 30 seconds.&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://tomato-timer.com/"&gt;Tomato Timer&lt;/a&gt; &lt;em&gt;A pomodoro clock I'm using to 
time myself and take breaks when necessary.&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;My Key Takeaways&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Giving up is not an option. You'll feel like it but just don't do it.&lt;/li&gt;
&lt;li&gt;Pace yourself, it's not a sprint.&lt;/li&gt;
&lt;li&gt;Plan ahead. Without planning you end up stranded and wasting a lot of 
time deciding on what to do.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;In conclusion, Have fun with the challenge💃💃, your mental health is just as important.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>100daysofcode</category>
    </item>
    <item>
      <title>How I'm taking the #100DaysOfCode challenge</title>
      <dc:creator>Gathoni Stone</dc:creator>
      <pubDate>Sat, 21 Mar 2020 16:43:22 +0000</pubDate>
      <link>https://dev.to/gathonis/how-i-m-taking-the-100daysofcode-challenge-3di</link>
      <guid>https://dev.to/gathonis/how-i-m-taking-the-100daysofcode-challenge-3di</guid>
      <description>&lt;p&gt;So last year I decided to join the [100 days of code challenge].&lt;/p&gt;

&lt;p&gt;It did not go as expected 😶&lt;/p&gt;

&lt;p&gt;I did it for a week and stopped altogether. 100 days seemed really intimidating at the time. After an invitation by a friend to take the challenge together, here I am doing it again, this time... a little bit differently.&lt;/p&gt;

&lt;p&gt;I realize the main reason I failed the last time was because I did not hold myself accountable. Therefore, I'm going to be documenting my journey through blog posts. For every 10 days, I'll be summarizing everything I've done and what I've learned, an idea I got from Sarah Bartley's post.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag__link"&gt;
  &lt;a href="/theoriginalbpc" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NpElAxir--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/practicaldev/image/fetch/s--TALdGAPs--/c_fill%2Cf_auto%2Cfl_progressive%2Ch_150%2Cq_auto%2Cw_150/https://dev-to-uploads.s3.amazonaws.com/uploads/user/profile_image/61140/fa4551ac-4fc2-4ca1-884d-325b97b0277b.jpg" alt="theoriginalbpc image"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="/theoriginalbpc/100-days-of-code-first-10-days-of-round-two-4gfj" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;100 Days of Code: First 10 Days of Round Two&lt;/h2&gt;
      &lt;h3&gt;Sarah Bartley ・ Jun 12 '19 ・ 10 min read&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#100daysofcode&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;
 

&lt;p&gt;&lt;strong&gt;&lt;em&gt;What will I be doing for the 100 days? 💭&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/a5viI92PAF89q/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/a5viI92PAF89q/giphy.gif" alt="batman thinking"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This was the hardest part!&lt;/p&gt;

&lt;p&gt;After scouring the internet for ideas and checking out what other people have done for the challenge, I have finally settled on doing the &lt;a href="https://www.freecodecamp.org/learn"&gt;freecodecamp &lt;/a&gt; take-home projects. I chose these projects mainly because they have clearly defined instructions and did not want to spend time creating my own problems then solve them. The projects also have already written tests which will be helpful in determining if my projects are working as required. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;The PLAN&lt;/em&gt;&lt;/strong&gt;😎&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Start Date&lt;/strong&gt;: Saturday,21st March 2020&lt;br&gt;
&lt;em&gt;step 1&lt;/em&gt;: Fork this github repo&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vJ70wriM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/kallaway"&gt;
        kallaway
      &lt;/a&gt; / &lt;a href="https://github.com/kallaway/100-days-of-code"&gt;
        100-days-of-code
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Fork this template for the 100 days journal - to keep yourself accountable (multiple languages available)
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
I've joined the #100DaysOfCode Challenge&lt;/h1&gt;
&lt;h2&gt;
Contents&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/kallaway/100-days-of-code/master/rules.md"&gt;Rules&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/kallaway/100-days-of-code/master/log.md"&gt;Log - click here to see my progress&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/kallaway/100-days-of-code/master/FAQ.md"&gt;FAQ&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/kallaway/100-days-of-code/master/resources.md"&gt;Resources&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
Translations&lt;/h2&gt;
&lt;p&gt;&lt;a href="https://raw.githubusercontent.com/kallaway/100-days-of-code/master/intl/bn/README.md"&gt;বাংলা&lt;/a&gt; - &lt;a href="https://raw.githubusercontent.com/kallaway/100-days-of-code/master/intl/ca/README.md"&gt;català&lt;/a&gt; - &lt;a href="https://raw.githubusercontent.com/kallaway/100-days-of-code/master/intl/ch/README.md"&gt;中文&lt;/a&gt; - &lt;a href="https://raw.githubusercontent.com/kallaway/100-days-of-code/master/intl/de/README.md"&gt;deutsch&lt;/a&gt; - &lt;a href="https://raw.githubusercontent.com/kallaway/100-days-of-code/master/intl/es/README.md"&gt;español&lt;/a&gt; – &lt;a href="https://raw.githubusercontent.com/kallaway/100-days-of-code/master/intl/fr/FAQ-fr.md"&gt;français&lt;/a&gt; – &lt;a href="https://raw.githubusercontent.com/kallaway/100-days-of-code/master/intl/it/README.md"&gt;italiano&lt;/a&gt; – &lt;a href="https://raw.githubusercontent.com/kallaway/100-days-of-code/master/intl/ja/README.md"&gt;日本語&lt;/a&gt; - &lt;a href="https://raw.githubusercontent.com/kallaway/100-days-of-code/master/intl/ko/README-ko.md"&gt;한국어&lt;/a&gt; – &lt;a href="https://raw.githubusercontent.com/kallaway/100-days-of-code/master/intl/no/README.md"&gt;norsk&lt;/a&gt; –  &lt;a href="https://raw.githubusercontent.com/kallaway/100-days-of-code/master/intl/pl/README.md"&gt;polski&lt;/a&gt; - &lt;a href="https://raw.githubusercontent.com/kallaway/100-days-of-code/master/intl/pt-br/LEIAME.md"&gt;português do Brasil&lt;/a&gt; - &lt;a href="https://raw.githubusercontent.com/kallaway/100-days-of-code/master/intl/ru/README-ru.md"&gt;русский&lt;/a&gt; – &lt;a href="https://raw.githubusercontent.com/kallaway/100-days-of-code/master/intl/ua/README-ua.md"&gt;українська&lt;/a&gt; - &lt;a href="https://raw.githubusercontent.com/kallaway/100-days-of-code/master/intl/el/README.md"&gt;ελληνικά&lt;/a&gt; - &lt;a href="https://raw.githubusercontent.com/kallaway/100-days-of-code/master/intl/sr/README-sr.md"&gt;srpski&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to help by providing a translation of content/rules in the language you know, submit a pull request (or DM me on Twitter &lt;a class="comment-mentioned-user" href="https://dev.to/ka11away"&gt;@ka11away&lt;/a&gt;
), adding a sub-folder in the 'intl' folder with the files of the translation there.&lt;/p&gt;

&lt;h2&gt;
If you've decided to join:&lt;/h2&gt;


&lt;ol start="0"&gt;
&lt;li&gt;Check out &lt;a href="http://100daysofcode.com/" rel="nofollow"&gt;the Official Site&lt;/a&gt; for the #100DaysOfCode movement. Connect with others on the platform of your choice from this list: &lt;a href="http://www.100DaysOfCode.com/connect" rel="nofollow"&gt;&lt;/a&gt;&lt;a href="http://www.100DaysOfCode.com/connect"&gt;www.100DaysOfCode.com/connect&lt;/a&gt;
Also, &lt;a href="https://join.slack.com/t/100xcode/shared_invite/zt-eivg7x1x-wgNPDh7ug_u4GcUwZNT8Zg" rel="nofollow"&gt;here&lt;/a&gt; is a invite link to the 100DaysOfCode Slack channel&lt;/li&gt;
&lt;li&gt;Read &lt;a href="https://medium.freecodecamp.com/join-the-100daysofcode-556ddb4579e4" rel="nofollow"&gt;Join the #100DaysOfCode&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Fork this repo and commit to the &lt;a href="https://raw.githubusercontent.com/kallaway/100-days-of-code/master/log.md"&gt;Log&lt;/a&gt; or to the Alternative, rapid &lt;a href="https://raw.githubusercontent.com/kallaway/100-days-of-code/master/r1-log.md"&gt;R1 Log&lt;/a&gt; (R1 stands…&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;br&gt;
  &lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/kallaway/100-days-of-code"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;
&lt;br&gt;&lt;br&gt;
&lt;em&gt;step 2&lt;/em&gt;: Commit progress to the log.md file.&lt;br&gt;&lt;br&gt;
&lt;em&gt;step 3&lt;/em&gt;: Code for at least an hour each day.

&lt;p&gt;&lt;strong&gt;Sidenote&lt;/strong&gt;: &lt;em&gt;My mentioned ☝️ friend and I have a WhatsApp group where we'll basically be updating our daily progress - to keep ourselves accountable.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Conclusion&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is my first post on this journey. The next will be after 10 days into the 100 days.&lt;br&gt;
Hopefully, I'll make it to then😄.&lt;/p&gt;

</description>
      <category>100daysofcode</category>
    </item>
  </channel>
</rss>
