<?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: Adenekan Wonderful</title>
    <description>The latest articles on DEV Community by Adenekan Wonderful (@code_wonders).</description>
    <link>https://dev.to/code_wonders</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%2F37066%2F210fe9c9-0c92-4f5d-9d99-f50a0df12424.png</url>
      <title>DEV Community: Adenekan Wonderful</title>
      <link>https://dev.to/code_wonders</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/code_wonders"/>
    <language>en</language>
    <item>
      <title>What are these things called generator functions* ?</title>
      <dc:creator>Adenekan Wonderful</dc:creator>
      <pubDate>Tue, 26 Nov 2019 13:45:44 +0000</pubDate>
      <link>https://dev.to/code_wonders/what-are-these-things-called-generator-functions-58nn</link>
      <guid>https://dev.to/code_wonders/what-are-these-things-called-generator-functions-58nn</guid>
      <description>&lt;p&gt;In this lessons, we are going to explore one really great new ishhhh that was introduced into the javascript ecosystem and native to javascript now, moreover we most times say that its a function that resembles &lt;code&gt;async/await&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Fun Fact — Async Await is actually built on generators 😆&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now don’t get me wrong its not exactly ASYN / AWAIT its got almost a different flare to it, but its very similar in the sense that in async / await functions we AWAIT our Asynchronous events (our promised based events) where we pause the execution inside of our Asynchronous whenever we see the await call.&lt;/p&gt;

&lt;p&gt;Well, our generator functions are very similar in the sense that they also pause their executions whenever they see a specific key inside of their function and that key is called a yield. now in other, for us to use this or achieve this there is a special syntax we actually have to declare our old school way of defining our function decorator but this time with a star beside it like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//codes here  
function* gen(){  
  // code goes here  
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now let's get to understand these things better, let's declare two console.log’s and see something here&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//codes here  
function* gen(){  
  console.log('Hello There');  
  console.log('I am a generator'); 
}   
// Now i'd declear my gen function to a const  
const gfunc = gen() 
// this would return undefined    
//when i call gfunc in the console i get these weird suspended and they are called a generator object  
/* gen {&amp;lt;suspended&amp;gt;} __proto__: 
Generator [[GeneratorLocation]]: 
VM275:1 [[GeneratorStatus]]: 
"suspended" [[GeneratorFunction]]: ƒ* gen() 
[[GeneratorReceiver]]: Window [[Scopes]]: Scopes[3] 
**/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now I know you might be a lot surprised at what's happening and why it's not doing our regular function executions where we would see our logs and all, but here is what we do on it, we call a &lt;code&gt;.next()&lt;/code&gt; on it, and what &lt;code&gt;.next()&lt;/code&gt; does is that I would resume the execution inside of our function, so at the point where we invoked it for the first time we instantiated this generator object that actually is aware of the code inside of our function but the execution inside of the &lt;code&gt;gen()&lt;/code&gt; function is paused.&lt;br&gt;
I know this might be a lot but it's easy what we do, in other to resume this function we just call the &lt;code&gt;.next()&lt;/code&gt; on the &lt;code&gt;gfunc&lt;/code&gt; const so until we call &lt;code&gt;.next()&lt;/code&gt; on our function might not be able to run the execution&lt;br&gt;
&lt;code&gt;gfunc.next()&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//Now this returns some things I want you to take note of   
Hello There I am a generator   
{  value: undefined,   done: true }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now we get our log and an additional object and this object contains our value prop and a done property, now the done property tells us if there is any code to still run and in our case, there is none so we get true. now lets clear this up and go into something a bit advance&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function* gen(i){  
   yield i;   
   yield i + 5; 
}  
cosnt gfunc = gen(10)

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;so now what we have done is that we have a &lt;code&gt;gen()&lt;/code&gt; function that takes in I as an argument and then we yield the argument we parse in, and the argument plus 5 then we declared a const and gave it a value of 5. are we good? YES! so when we call a &lt;code&gt;gfunc.next()&lt;/code&gt; let's see what we get.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gfunc.next()
//returns 
{
    value: 5, 
    done: false
}

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;so now we see that the value property in the object is the initial yield we mapped in the function and the done is false, why? now that's because we are not done playing our execution in the function meaning that there is more in the function it only paused after our first yield, now let's see what happens when we do &lt;code&gt;.next()&lt;/code&gt; again&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gfunc.next()
//returns 
{
    value: 10, 
    done: false
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;now we see that the value property in the object now contains our updated value and our done property is still false, now this is because in our yield function we never declared a return value and this is required so our generator function can know when to stop the execution. so now if we add a return value we see that our done returns true like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function* gen(i){ 
   yield i; 
   yield i + 5; 
   return 20; 
}
cosnt gfunc = gen(10)
// first execution
gfunc.next()
//returns 
{
    value: 5, 
    done: false
} 
//second execution
gfunc.next()
//returns 
{
    value: 10, 
    done: false
} 
//final execution 
gfunc.next()
//returns 
{
    value: 20, 
    done: true
}

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now you see that we have our done value as true after the execution is done. this is primarily the base use of generator functions if you want to stash multiple executions but you want to control when you want to pause and play the execution. think of it as&lt;/p&gt;

&lt;p&gt;&lt;code&gt;An ability to pause functions&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I think we should stop here for now. so the key thing you need to remember is, wherever we see yield that means our code is paused at that point even if its an Asynchronous code just like &lt;code&gt;async / await.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I know that we have spent a lot of time talking about generator functions but then if you don't still understand, you can go over the article over and over again or I’d but in some great resources to aid your learning. see you in my other articles 😊&lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
    <item>
      <title>Vue.js Quickstart Tutorial by @code_wonders</title>
      <dc:creator>Adenekan Wonderful</dc:creator>
      <pubDate>Wed, 23 May 2018 11:47:21 +0000</pubDate>
      <link>https://dev.to/code_wonders/vuejs-2-quickstart-tutorial-by-codewonders-2972</link>
      <guid>https://dev.to/code_wonders/vuejs-2-quickstart-tutorial-by-codewonders-2972</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fscotch.io%2Fwp-content%2Fuploads%2F2015%2F08%2Fvuejs-cover.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fscotch.io%2Fwp-content%2Fuploads%2F2015%2F08%2Fvuejs-cover.png" alt="Vue JS Logo"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Vue.js Quickstart Tutorial by &lt;a class="mentioned-user" href="https://dev.to/code_wonders"&gt;@code_wonders&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Vue.js&lt;/strong&gt;&lt;br&gt;
Vue is a progressive JavaScript framework that focuses on building user interfaces. As it only works in the &lt;strong&gt;“view layer”&lt;/strong&gt; it makes no assumption of middleware and backend and therefore can be integrated easily into other projects and libraries. Vue.js offers a lot of functionality for the view layer and can be used for building powerful single-page webapps. In the following you can find a list of features:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reactive Interfaces&lt;/li&gt;
&lt;li&gt;Declarative Rendering&lt;/li&gt;
&lt;li&gt;Data Binding&lt;/li&gt;
&lt;li&gt;Directives&lt;/li&gt;
&lt;li&gt;Template Logic&lt;/li&gt;
&lt;li&gt;Components&lt;/li&gt;
&lt;li&gt;Event Handling&lt;/li&gt;
&lt;li&gt;Computed Properties&lt;/li&gt;
&lt;li&gt;CSS Transitions and Animations&lt;/li&gt;
&lt;li&gt;Filters&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;The Vue.js 2 core library is very small in size (only 17 kB). This ensures that the overhead which is added to your project by using Vue.js is minimal and your website is loading fast. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The Vue.js website is available at: &lt;a href="https://vuejs.org/" rel="noopener noreferrer"&gt;https://vuejs.org/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to use Vue.js&lt;/strong&gt;&lt;br&gt;
There are different ways to include Vue.js in your web project:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use CDN by including tag &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; in HTML file&lt;/li&gt;
&lt;li&gt;Install using Node Package Manager (NPM)&lt;/li&gt;
&lt;li&gt;Install using Bower&lt;/li&gt;
&lt;li&gt;Use Vue-cli to setup your project&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the following we’re going to the Vue-cli to setup a new project and install the Vue.js 2 library.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Using Vue-cli&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First, we need to install Vue-cli. The commend line interface is available as an NPM package. Make sure that Node.js and the npm command is available on your system and use the following command to install the Vue CLI globally on your local system:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ npm install -g vue-cli&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Having installed the client successfully the vue command becomes available. Now we're able to initiate a project by using this command in the following way:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ vue init webpack learningVue&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;We're telling vue to initiate a new project and use the webpack template. We also give the project the name &lt;strong&gt;learningVue&lt;/strong&gt;. Executing the command brings up a few questions on the command line as you can see in the following screenshot:&lt;/p&gt;

&lt;p&gt;The project is created in the folder &lt;strong&gt;learningVue&lt;/strong&gt;. Change into that directory with the following command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ cd learningVue&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Start installing the dependencies by using npm again:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ npm install&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After having completed the installation of packages you can start the web server in development mode by using npm in the following way:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ npm run dev&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This will start the server on port 8080 and the application output is displayed in the browser automatically:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F800%2F1%2AGuIRPERP01oedu0iIAtqyA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F800%2F1%2AGuIRPERP01oedu0iIAtqyA.png" alt="Vue JS Logo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Later, if you want to build for production you can use the following command instead. In this case a dist folder is created containing the files needed for productive deployment. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ npm run build&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Project Structure&lt;/strong&gt;&lt;br&gt;
Let’s take a look at the initial project structure which is available in folder &lt;em&gt;learningVue&lt;/em&gt;:&lt;/p&gt;

&lt;p&gt;In the project root folder you can find files and folders. Let’s examine the most important ones. The &lt;code&gt;package.json&lt;/code&gt; files contains all the dependencies of your project. By using the command npm install before we have made sure that the dependencies listed in &lt;code&gt;package.json&lt;/code&gt; are installed into the node_modules folder of the project. &lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F7884263%2F26864362-92f409de-4b0c-11e7-8a5d-5b87a9715dc1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F7884263%2F26864362-92f409de-4b0c-11e7-8a5d-5b87a9715dc1.png" alt="Vue JS Logo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The file &lt;code&gt;index.html&lt;/code&gt; contains the following HTML code:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;br&gt;
&amp;lt;html&amp;gt;&lt;br&gt;
  &amp;lt;head&amp;gt;&lt;br&gt;
    &amp;lt;meta charset="utf-8"&amp;gt;&lt;br&gt;
    &amp;lt;title&amp;gt;vueapp01&amp;lt;/title&amp;gt;&lt;br&gt;
  &amp;lt;/head&amp;gt;&lt;br&gt;
  &amp;lt;body&amp;gt;&lt;br&gt;
    &amp;lt;div id="app"&amp;gt;&amp;lt;/div&amp;gt;&lt;br&gt;
    &amp;lt;!-- built files will be auto injected --&amp;gt;&lt;br&gt;
  &amp;lt;/body&amp;gt;&lt;br&gt;
&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;This file is the starting point of your application. Note that within the body section a &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; element is available which has the id property set to string app. This element is used as a placeholder for the output which is generated by Vue.js. &lt;/p&gt;

&lt;p&gt;Next take a look at file &lt;code&gt;main.js&lt;/code&gt; in folder &lt;code&gt;src&lt;/code&gt;. That's the place where the Vue application is initialized:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;import Vue from 'vue'&lt;br&gt;
import App from './App'&lt;br&gt;
new Vue({&lt;br&gt;
  el: '#app',&lt;br&gt;
  template: '&amp;lt;App/&amp;gt;',&lt;br&gt;
  components: { App }&lt;br&gt;
})&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;On top of the file you can find two import statements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;import Vue from 'vue': Vue is the main class of the framework&lt;/li&gt;
&lt;li&gt;import App from './App': App is the root component of out application&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By using the new keyword a new instance of the main framework class Vue is created. The constructor takes an object as a parameter which contains three properties:&lt;br&gt;
el: By assigning the string #app to this property we're defining that the output of the Vue application should be rendered to the &lt;code&gt;&amp;lt;div id="app"&amp;gt;&amp;lt;/div&amp;gt;&lt;/code&gt; element in index.html.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;template: The template contains the HTML code which is used to generate the output of the Vue.js application.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;components: List of Vue.js components which are used in the template.&lt;br&gt;
The template only consists of one element: &lt;code&gt;&amp;lt;App/&amp;gt;&lt;/code&gt;. Of course this is not a standard HTML element. This is the element which is assigned to App component. In order to be able to use &lt;code&gt;&amp;lt;App/&amp;gt;&lt;/code&gt; in the template the App component is also listed in the object which is assigned to the components property. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So let's see what's inside the App component implementation in file &lt;code&gt;App.vue&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;template&amp;gt;&lt;br&gt;
  &amp;lt;div id="app"&amp;gt;&lt;br&gt;
    &amp;lt;img src="./assets/logo.png"&amp;gt;&lt;br&gt;
    &amp;lt;hello&amp;gt;&amp;lt;/hello&amp;gt;&lt;br&gt;
  &amp;lt;/div&amp;gt;&lt;br&gt;
&amp;lt;/template&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;code&gt;&amp;lt;script&amp;gt;&lt;br&gt;
import Hello from './components/Hello'&lt;br&gt;
export default {&lt;br&gt;
  name: 'app',&lt;br&gt;
  components: {&lt;br&gt;
    Hello&lt;br&gt;
  }&lt;br&gt;
}&lt;br&gt;
&amp;lt;/script&amp;gt;&lt;/code&gt;&lt;br&gt;
 &lt;code&gt;&amp;lt;style&amp;gt;&lt;br&gt;
 app {&lt;br&gt;
  font-family: 'Avenir', Helvetica, Arial, sans-serif;&lt;br&gt;
  -webkit-font-smoothing: antialiased;&lt;br&gt;
  -moz-osx-font-smoothing: grayscale;&lt;br&gt;
  text-align: center;&lt;br&gt;
  color: #2c3e50;&lt;br&gt;
  margin-top: 60px;&lt;br&gt;
}&lt;br&gt;
&amp;lt;/style&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;As in every &lt;code&gt;Vue.js 2&lt;/code&gt; single-file component the App implementation is split up into three parts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;: Component's template code&lt;/li&gt;
&lt;li&gt;: Component's script code&lt;/li&gt;
&lt;li&gt;: Component' CSS code&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s focus on the the first two sections template and script. The script section is making a default export of an object declaraing the component named app. Again, the components property is used to declare that another component (Hello) is required by App. This subcomponent is used in the template code of app and implemented in file hello.vue in folder components. In order to be able to use the Hello component in App it’s also needed to include the corresponding import statement on top of the script section.&lt;/p&gt;

&lt;p&gt;The implementation of component Hello looks like the following:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;template&amp;gt;&lt;br&gt;
  &amp;lt;div class="hello"&amp;gt;&lt;br&gt;
    &amp;lt;h1&amp;gt;{{ msg }}&amp;lt;/h1&amp;gt;&lt;br&gt;
    &amp;lt;h2&amp;gt;Essential Links&amp;lt;/h2&amp;gt;&lt;br&gt;
    &amp;lt;ul&amp;gt;&lt;br&gt;
      &amp;lt;li&amp;gt;&amp;lt;a href="https://vuejs.org" target="_blank"&amp;gt;Core Docs&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br&gt;
      &amp;lt;li&amp;gt;&amp;lt;a href="https://forum.vuejs.org" target="_blank"&amp;gt;Forum&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br&gt;
      &amp;lt;li&amp;gt;&amp;lt;a href="https://gitter.im/vuejs/vue" target="_blank"&amp;gt;Gitter Chat&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br&gt;
      &amp;lt;li&amp;gt;&amp;lt;a href="https://twitter.com/vuejs" target="_blank"&amp;gt;Twitter&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br&gt;
      &amp;lt;br&amp;gt;&lt;br&gt;
      &amp;lt;li&amp;gt;&amp;lt;a href="http://vuejs-templates.github.io/webpack/" target="_blank"&amp;gt;Docs for This Template&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br&gt;
    &amp;lt;/ul&amp;gt;&lt;br&gt;
    &amp;lt;h2&amp;gt;Ecosystem&amp;lt;/h2&amp;gt;&lt;br&gt;
    &amp;lt;ul&amp;gt;&lt;br&gt;
      &amp;lt;li&amp;gt;&amp;lt;a href="http://router.vuejs.org/" target="_blank"&amp;gt;vue-router&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br&gt;
      &amp;lt;li&amp;gt;&amp;lt;a href="http://vuex.vuejs.org/" target="_blank"&amp;gt;vuex&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br&gt;
      &amp;lt;li&amp;gt;&amp;lt;a href="http://vue-loader.vuejs.org/" target="_blank"&amp;gt;vue-loader&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br&gt;
      &amp;lt;li&amp;gt;&amp;lt;a href="https://github.com/vuejs/awesome-vue" target="_blank"&amp;gt;awesome-vue&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br&gt;
    &amp;lt;/ul&amp;gt;&lt;br&gt;
  &amp;lt;/div&amp;gt;&lt;br&gt;
&amp;lt;/template&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;code&gt;&amp;lt;script&amp;gt;&lt;br&gt;
export default {&lt;br&gt;
  name: 'hello',&lt;br&gt;
  data () {&lt;br&gt;
    return {&lt;br&gt;
      msg: 'Welcome to Your Vue.js App'&lt;br&gt;
    }&lt;br&gt;
  }&lt;br&gt;
}&lt;br&gt;
&amp;lt;/script&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;em&gt;&amp;lt;!-- Add "scoped" attribute to limit CSS to this component only --&amp;gt;&lt;/em&gt;&lt;br&gt;
&lt;code&gt;style scoped&lt;br&gt;
h1, h2 {&lt;br&gt;
  font-weight: normal;&lt;br&gt;
}&lt;br&gt;
ul {&lt;br&gt;
  list-style-type: none;&lt;br&gt;
  padding: 0;&lt;br&gt;
}&lt;br&gt;
li {&lt;br&gt;
  display: inline-block;&lt;br&gt;
  margin: 0 10px;&lt;br&gt;
}&lt;br&gt;
a {&lt;br&gt;
  color: #42b983;&lt;br&gt;
}&lt;br&gt;
/style&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The component configuration object is exported as default. This time the component configuration object contains a data method. This method returns an object which represents the component’s model. Properties defined in the model object can be used in the component’s template by using the interpolation syntax. In the example from above the model object has only one property: msg. The string which is assigned to this property is included in the component’s template by using:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;h1&amp;gt;{{ msg }}&amp;lt;/h1&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The interpolation syntax required double curly braces to include model data in the template.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Using Standard Directives&lt;/strong&gt;&lt;br&gt;
Let’s adapt the Hello component implementation to learn more about the usage of Vue.js standard directives.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;v-for&lt;/strong&gt;&lt;br&gt;
The v-for directive makes it possible to render an element multiple times based on source data. You can use this directive to iterate over an array and at the array data to the output. First add an array to the object which is returned by the data method:&lt;br&gt;
&lt;code&gt;users: [&lt;br&gt;
        {firstname: 'Sebastian', lastname: 'Eschweiler'},&lt;br&gt;
        {firstname: 'Bill', lastname: 'Smith'},&lt;br&gt;
        {firstname: 'John', lastname: 'Porter'}&lt;br&gt;
      ],&lt;/code&gt;&lt;br&gt;
Then use the v-for directive to include a list in the output printing out the firstname and lastname value of each array element:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;div&amp;gt;&lt;br&gt;
      &amp;lt;ul&amp;gt;&lt;br&gt;
        &amp;lt;li v-for="user in users"&amp;gt;&lt;br&gt;
          {{user.firstname}} {{user.lastname}}&lt;br&gt;
        &amp;lt;/li&amp;gt;&lt;br&gt;
      &amp;lt;/ul&amp;gt;&lt;br&gt;
    &amp;lt;/div&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;v-model&lt;/strong&gt;&lt;br&gt;
The v-model directive creates a two-way binding on an input element or a component. Make sure to define a property in your data object which should be used as the binding target:&lt;br&gt;
input_val: ''&lt;br&gt;
Then use the directive to bind the value of an input element to that property:&lt;br&gt;
&lt;code&gt;&amp;lt;div&amp;gt;&lt;br&gt;
      &amp;lt;input type="text" v-model="input_val"&amp;gt;&lt;br&gt;
&amp;lt;/div&amp;gt;&lt;/code&gt;&lt;br&gt;
With that binding established we’re getting two effects:&lt;br&gt;
everytime the user enters a value in the input field the value of input_val is updated accordingly&lt;br&gt;
If we change the value of input_val in our program the value which is displayed in the input element is updated as well&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;v-text&lt;/strong&gt;&lt;br&gt;
By using the v-text directive the text content of an element is set. We can use it as an alternative to the {{ … }} syntax if the complete text content should be set. E.g. we can use this directive to output the input_val value to the user:&lt;br&gt;
Input Value: &lt;span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;br&gt;
The complete code of the adapted Hello component implementation should now look like the following:&lt;br&gt;
&lt;code&gt;&amp;lt;template&amp;gt;&lt;br&gt;
  &amp;lt;div class="hello"&amp;gt;&lt;br&gt;
    &amp;lt;h1&amp;gt;{{ msg }}&amp;lt;/h1&amp;gt;&lt;br&gt;
    &amp;lt;hr /&amp;gt;&lt;br&gt;
    &amp;lt;div&amp;gt;&lt;br&gt;
      &amp;lt;ul&amp;gt;&lt;br&gt;
        &amp;lt;li v-for="user in users"&amp;gt;&lt;br&gt;
          {{user.firstname}} {{user.lastname}}&lt;br&gt;
        &amp;lt;/li&amp;gt;&lt;br&gt;
      &amp;lt;/ul&amp;gt;&lt;br&gt;
    &amp;lt;/div&amp;gt;&lt;br&gt;
    &amp;lt;hr /&amp;gt;&lt;br&gt;
    &amp;lt;div&amp;gt;&lt;br&gt;
      &amp;lt;input type="text" v-model="input_val"&amp;gt;&lt;br&gt;
    &amp;lt;/div&amp;gt;&lt;br&gt;
    &amp;lt;div&amp;gt;&lt;br&gt;
      Input Value: &amp;lt;span v-text="input_val"&amp;gt;&amp;lt;/span&amp;gt;&lt;br&gt;
    &amp;lt;/div&amp;gt;&lt;br&gt;
    &amp;lt;hr /&amp;gt;&lt;br&gt;
    &amp;lt;div&amp;gt;&lt;br&gt;
      &amp;lt;button class="btn btn-primary" v-on:click="counter++"&amp;gt;You've clicked this button {{counter}} times!&amp;lt;/button&amp;gt;&lt;br&gt;
    &amp;lt;/div&amp;gt;&lt;br&gt;
  &amp;lt;/div&amp;gt;&lt;br&gt;
&amp;lt;/template&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;code&gt;&amp;lt;script&amp;gt;&lt;br&gt;
export default {&lt;br&gt;
  name: 'hello',&lt;br&gt;
  data () {&lt;br&gt;
    return {&lt;br&gt;
      msg: 'Welcome to Your Vue.js App',&lt;br&gt;
      users: [&lt;br&gt;
        {firstname: 'Sebastian', lastname: 'Eschweiler'},&lt;br&gt;
        {firstname: 'Bill', lastname: 'Smith'},&lt;br&gt;
        {firstname: 'John', lastname: 'Porter'}&lt;br&gt;
      ],&lt;br&gt;
      input_val: '',&lt;br&gt;
      counter: 0&lt;br&gt;
    }&lt;br&gt;
  }&lt;br&gt;
}&lt;br&gt;
&amp;lt;/script&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;em&gt;&amp;lt;!-- Add "scoped" attribute to limit CSS to this component only --&amp;gt;&lt;/em&gt;&lt;br&gt;
&lt;code&gt;&amp;lt;style scoped&amp;gt;&lt;br&gt;
h1, h2 {&lt;br&gt;
  font-weight: normal;&lt;br&gt;
}&lt;br&gt;
ul {&lt;br&gt;
    list-style-position: inside;&lt;br&gt;
}&lt;br&gt;
a {&lt;br&gt;
  color: #42b983;&lt;br&gt;
}&lt;br&gt;
&amp;lt;/style&amp;gt;&lt;/code&gt;&lt;br&gt;
The result can be seen in the following screenshot:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F800%2F1%2AxdoMDrZ5XUIFRz8Bg1AFMA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F800%2F1%2AxdoMDrZ5XUIFRz8Bg1AFMA.png" alt="Vue JS Logo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Article credit to &lt;strong&gt;CodingTheSmartWay.com&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>vue</category>
      <category>javascript</category>
      <category>node</category>
      <category>codenewbie</category>
    </item>
  </channel>
</rss>
