<?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"><channel><title><![CDATA[The Aspire]]></title><description><![CDATA[A Software Engineer, passionate about building ultra-fast, scalable and useful applications. I learn and know enough to get the job done.]]></description><link>https://developeraspire.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Mon, 16 Nov 2026 06:24:38 GMT</lastBuildDate><atom:link href="https://developeraspire.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Understanding React Hooks; useEffect()]]></title><description><![CDATA[React has different features that allow developers to build applications with them, some of those features are Hooks. The useEffect hook which I will be…]]></description><link>https://developeraspire.hashnode.dev/understanding-react-hooks-useeffect</link><guid isPermaLink="true">https://developeraspire.hashnode.dev/understanding-react-hooks-useeffect</guid><category><![CDATA[React]]></category><category><![CDATA[ReactHooks]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[Web Development]]></category><dc:creator><![CDATA[Franklin Okolie]]></dc:creator><pubDate>Mon, 30 Aug 2021 08:38:35 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1628499066456/GxhW5txnB.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>React has different features that allow developers to build applications with them, some of those features are Hooks. The useEffect hook which I will be explaining in this article is an important Hook used when building modern applications with React.</p>
<p>This article is the second article from the series "React Hooks" on this blog where I demystify React Hooks.</p>
<p>In this article, I am going to explain the useEffect hook and the concept behind it.</p>
<blockquote>
<p>If this is your first time learning about React Hooks, I strongly recommend you start from the first article on this series  <a target="_blank" href="https://developeraspire.hashnode.dev/understanding-react-hooks-usestate">here</a> </p>
</blockquote>
<h3 id="prerequisites"><strong>Prerequisites</strong></h3>
<p>This article assumes you have the following:</p>
<ul>
<li>Node &gt;= 8.10 installed on their local development machine</li>
<li>npx 5.2 or higher installed on their local development machine</li>
<li>Basic understanding of JavaScript's ES6.</li>
<li>Basic knowledge of ReactJS</li>
</ul>
<h2 id="how-react-works">How React works</h2>
<p>React gives us a way to split our code and logic via components that can be assembled to make an application. These components are a chunk of JavaScript codes that performs a specific functionality on our application. React handles the props, state, and how JSX is rendered on the UI, this is what React does base on each component it evaluates.</p>
<p>React re-evaluates each component when any of the props, state, or JSX changes, this means the components are re-rendered and changes are made where necessary.</p>
<p>But what about stuff like HTTP requests, timers, or specific functions that we want to run as a side effect and not affect our components? Does React have a way of handling it?</p>
<p>For example, I am building an application that fetches tweets from Twitter API when it loads for the very first time. From my explanation above we know that when ever any state, props, or JSX changes React re-evaluates a component to make changes where necessary. This means if we make the HTTP request in our React app, whenever there are any changes, another HTTP request will be sent to the Twitter API, but is this how I really want my application to work?</p>
<p>Not only does Twitter API have a limited amount of calls per hour, but this method is also performance-intensive because it is tasking our browser each time there is a change in a component. Let's take a look at the code snippet below for more context:</p>
<pre><code><span class="hljs-comment">// An application that get tweets from Twitter</span>
<span class="hljs-comment">// when it loads for the very first time</span>

import React, {useState} <span class="hljs-keyword">from</span> <span class="hljs-string">'react

const GetTweets =  ()=&gt; {

const [name, setName] = useState(null)

const addName = (e) =&gt; {
setName(e.target.value)
}

let tweets;
const fetchTweet = async ()=&gt; {
const response = await fetch ('</span>https:<span class="hljs-comment">//api.twitter.com/tweets')</span>
  tweets = await response.json()
}

<span class="hljs-keyword">return</span> (
      &lt;div&gt;
            &lt;p&gt;{tweets.result} &lt;/p&gt;
              &lt;input type=<span class="hljs-string">"text"</span> placeholder=<span class="hljs-string">"Type your name here"</span>
              onChange={addName} /&gt;
&lt;/div&gt;
)
}

export <span class="hljs-keyword">default</span> GetTweets
</code></pre><p>From the code snippet above, when the component gets mounted on the browser, an HTTP request is sent to Twitter immediately for tweets and displays the result in a paragraph. From our application requirement above we just solved the issue. </p>
<p>Now there is also an input box for users to type their names and the text inputted is passed down to a state on every click. This is because of the state change, React re-evaluates the components over and over again until the user's name is complete, this also affects our API call as Twitter endpoints get called during that time. Is this what a modern application should be like? Of course not. I want the application to get that tweet once and that should only occur when the application is first opened on the browser, any other activity happening in the React application should not apply to that API call.</p>
<p> But how do we solve an issue like this? There comes the useEffect hook to the rescue.</p>
<h2 id="the-useeffect-react-hook">The useEffect React Hook</h2>
<p>Sometimes called Side Effect, useEffect hook is a React hook used to handle 'side effect' in a React application. From the explanation above, I stated that "React handles the props, state, and how JSX is rendered on the UI, this is what React does bases on each component it evaluates.". </p>
<p>So other functionalities like HTTP requests, animations, timers e.t.c are side effects that are handled by useEffect. In the code snippet below, I will modify the application that gets tweets with the useEffect hook.</p>
<pre><code><span class="hljs-comment">// An application that get tweets from Twitter</span>
<span class="hljs-comment">// when it loads for the very first time</span>
<span class="hljs-keyword">import</span> React, {useState, useEffect} <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>

<span class="hljs-keyword">const</span> GetTweets = <span class="hljs-keyword">async</span> ()=&gt; {
<span class="hljs-keyword">let</span> tweets;

<span class="hljs-keyword">const</span> [name, setName] = useState(<span class="hljs-literal">null</span>)

useEffect(<span class="hljs-function">()=&gt;</span>{
      <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">fetchTweet</span> (<span class="hljs-params"></span>)</span>{
   <span class="hljs-keyword">const</span> response = <span class="hljs-keyword">await</span> fetch(<span class="hljs-string">"https://api.twitter.com/tweets"</span>);
   tweets = <span class="hljs-keyword">await</span> response.json();
      }

}, [])

<span class="hljs-keyword">const</span> addName = <span class="hljs-function">(<span class="hljs-params">e</span>) =&gt;</span> {
setName(e.target.value)
}

<span class="hljs-keyword">return</span> (
  <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>{tweets.result} <span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> 
   <span class="hljs-attr">placeholder</span>=<span class="hljs-string">"Type your name here"</span> <span class="hljs-attr">onChange</span>=<span class="hljs-string">{addName}</span> /&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
);
}

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> GetTweets
</code></pre><p>From the code snippet above, I have modified the code using the useEffect hook to handle the API call.</p>
<p>The useEffect hook accepts two arguments, the first one is the function that gets executed when there is a component re-evaluation if any of the dependencies changes and the second argument is an array of the dependencies.  </p>
<p>In the code snippet above, the function that calls the Twitter API is the first argument, while the second argument is an empty array of dependency, why that? Let me explain</p>
<p>Since I don't want my application calling out to Twitter API for every component re-evaluation I put it in a useEffect hook. The dependency array is empty, so if there is any re-evaluation of the component, useEffect makes a quick check on the dependency array to see if any of the dependencies changed, if yes? it executes the function. But in the case above it is empty so it doesn't re-execute the function.</p>
<p>So our API call to Twitter is not affected when React re-evaluates the component on state changes, useEffect just saved us that stress!.</p>
<p>If I want the API call to be made whenever there is a state change when the user types, I would simply add the state </p>
<pre><code><span class="hljs-keyword">import</span> React, {useState, useEffect} <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>

<span class="hljs-keyword">const</span> GetTweets = <span class="hljs-keyword">async</span> ()=&gt; {
<span class="hljs-keyword">let</span> tweets;

<span class="hljs-keyword">const</span> [name, setName] = useState(<span class="hljs-literal">null</span>)

useEffect(<span class="hljs-function">()=&gt;</span>{
      <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">fetchTweet</span> (<span class="hljs-params"></span>)</span>{
   <span class="hljs-keyword">const</span> response = <span class="hljs-keyword">await</span> fetch(<span class="hljs-string">"https://api.twitter.com/tweets"</span>);
   tweets = <span class="hljs-keyword">await</span> response.json();
      }

}, [name])

<span class="hljs-keyword">const</span> addName = <span class="hljs-function">(<span class="hljs-params">e</span>) =&gt;</span> {
setName(e.target.value)
}

<span class="hljs-keyword">return</span> (
  <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>{tweets.result} <span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> 
    <span class="hljs-attr">placeholder</span>=<span class="hljs-string">"Type your name here"</span> <span class="hljs-attr">onChange</span>=<span class="hljs-string">{addName}</span> /&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
);
}

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> GetTweets
</code></pre><p>From the code sample above, the API is called whenever the <code>name</code> state, which does changes after every input by the user.</p>
<p>That is all about the useEffect and how it is used. it is used to handle side effects in our React applications.</p>
<h2 id="conclusion">Conclusion</h2>
<p> I really do hope you enjoyed reading this article. </p>
<p>The next article on this  <a target="_blank" href="https://developeraspire.hashnode.dev/series/react-hooks">React Hook series</a>  would be on the Effect Hook and how it can be used, so follow me to get notified when it gets posted.</p>
<p> If you did learn something please like, share, comment, just do anything to make it go viral. </p>
<p>If you have any questions concerning Go, Javascript, TailwindCSS, Open-source, or this article? You can reach me on <a target="_blank" href="https://twitter.com/DeveloperAspire">Twitter</a>. Till next time, see you in the next article on this series. Thank you.</p>
]]></content:encoded></item><item><title><![CDATA[My experience in HNG so far]]></title><description><![CDATA[I have learnt how to organize myself, listen to instructions and work with people, it has also helped me understand the importance of relationships with…]]></description><link>https://developeraspire.hashnode.dev/my-experience-in-hng-so-far</link><guid isPermaLink="true">https://developeraspire.hashnode.dev/my-experience-in-hng-so-far</guid><dc:creator><![CDATA[Franklin Okolie]]></dc:creator><pubDate>Mon, 23 Aug 2021 16:32:45 GMT</pubDate><content:encoded><![CDATA[<p>I have learnt how to organize myself, listen to instructions and work with people, it has also helped me understand the importance of relationships with people.</p>
<p>So far in this internship, I have learnt that skills is not only what takes anyone far but the strength of people around you.</p>
]]></content:encoded></item><item><title><![CDATA[The Journey begins...]]></title><description><![CDATA[There comes a time in everyone's life where they have to take the risk necessary to move up to the next stage in their career, finance, or life. I think…]]></description><link>https://developeraspire.hashnode.dev/the-journey-begins</link><guid isPermaLink="true">https://developeraspire.hashnode.dev/the-journey-begins</guid><category><![CDATA[Web Development]]></category><category><![CDATA[internships]]></category><dc:creator><![CDATA[Franklin Okolie]]></dc:creator><pubDate>Mon, 16 Aug 2021 08:57:04 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1629104149668/assPnSCJH.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>There comes a time in everyone's life where they have to take the risk necessary to move up to the next stage in their career, finance, or life. I think mine has come,  a time for me to be a better Software Engineer who is focused on solving problems by building amazing solutions.</p>
<p>I intend to achieve that through my participation in the  <a target="_blank" href="https://internship.zuri.team">HNG Internship 8</a>, an internship known for bringing the best in people, testing their will and might, and pushing them to be a better version of themselves. My goal is to be hyper-focused, finish my tasks till the end, without ever thinking of giving up for the next 8 weeks.</p>
<h3 id="what-are-my-goals">What are my goals?</h3>
<p>Through the  <a target="_blank" href="https://internship.zuri.team">HNG Internship 8</a>, I would love to learn and improve my skills as a Frontend Software Engineer by:</p>
<ul>
<li>Learning how to build pixel-perfect designs.</li>
<li>Learn effective communication.</li>
<li>Build up my skills in React and CSS through building real-life projects.</li>
<li>Polishing up my portfolio with projects I will build in this internship.</li>
<li>Learn how to be an effective team player.</li>
<li>Push myself beyond my limits</li>
<li>Discipline.</li>
</ul>
<p>The above-listed points are my goals for this internship which I hope to finish and be part of the finalists.</p>
<h3 id="tutorials">Tutorials</h3>
<p>Below is a list of beginner tutorials for anyone looking to get started in Tech either as a designer or a developer.</p>
<ul>
<li><a target="_blank" href="https://www.youtube.com/watch?v=UB1O30fR-EE&amp;t=2s">HTML Tutorial</a> </li>
<li><a target="_blank" href="https://www.youtube.com/watch?v=SWYqp7iY_Tc&amp;t=693s">Git Tutorial</a></li>
<li><a target="_blank" href="https://www.youtube.com/watch?v=jk1T0CdLxwU&amp;t=606s">Figma Tutorial</a></li>
<li><a target="_blank" href="https://www.youtube.com/watch?v=hdI2bqOjy3c&amp;t=4s">JavaScript Tutorial</a></li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Understanding React Hooks; useState()]]></title><description><![CDATA[Understanding React Hooks, starting with an introduction to hooks and narrowing down to one of the important hooks; useState()]]></description><link>https://developeraspire.hashnode.dev/understanding-react-hooks-usestate</link><guid isPermaLink="true">https://developeraspire.hashnode.dev/understanding-react-hooks-usestate</guid><category><![CDATA[React]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Beginner Developers]]></category><dc:creator><![CDATA[Franklin Okolie]]></dc:creator><pubDate>Wed, 04 Aug 2021 09:29:29 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1624968971449/QFR93YhZs.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>If you probably just started learning React or you are coming from a different framework entirely to learn React, there are some concepts in React that are bound to confuse you. React is an amazing library and there are some of the features React has and uses that are actually tied to JavaScript and without a solid understanding of JavaScript, it is really hard to grasp. </p>
<p>This is the first article in the 'React Hooks' series where I will demystify Hooks - one of the key concepts every React developer should know. </p>
<p>In this article, I will help you understand the useState React Hook, and how to use it.</p>
<h3 id="prerequisites"><strong>Prerequisites</strong></h3>
<p>This article assumes you have the following:</p>
<ul>
<li>Node &gt;= 8.10 installed on their local development machine
npx 5.2 or higher installed on their local development machine</li>
<li>Basic understanding of JavaScript's ES6.</li>
<li>Basic knowledge of ReactJS</li>
</ul>
<h2 id="what-are-hooks-in-reactjs">What are Hooks in ReactJS?</h2>
<p>Hooks are a set functions that let you "hook into" React state and lifecycle hooks from function components.</p>
<p>In React, you can declare and use components using either the Class-based or Functional components. Hooks are supported in Class components because Hooks were introduced for Functional components which is the latest way we can declare components in React, so this article will be mainly focused on how to use Hooks on that which it is made for: Functional components</p>
<p>That is what Hook really means, it just provides some functions we use to work with function components so we can use some features of React and those features will be explained further in this article. There are also different types of hooks and each has its own use cases.</p>
<ul>
<li>useState Hook</li>
<li>useEffect Hook</li>
<li>useContext Hook</li>
<li>useReducer Hook</li>
<li>useRef Hook</li>
<li>useCallback</li>
<li>useMemo</li>
<li>useImperativeHandle</li>
<li>useLayoutEffect</li>
<li>useDebugValue</li>
</ul>
<h3 id="rules-of-hooks">Rules of Hooks</h3>
<p>Before I dive into explaining the first Hook on the list above, I will like to state and explain the rules of hooks - where you can use hooks and where you cannot use them.</p>
<ul>
<li>Only call at the <strong>top level of your component</strong>: Don’t call Hooks inside loops, conditions, or nested functions. Hooks are functions, so before we use them we need to call them but there are places in your code you shouldn't do it. The code below explains where we can use a React hook and where we should not use them. </li>
</ul>
<pre><code class="lang-JavaScript">
<span class="hljs-keyword">const</span> hooksRule = <span class="hljs-function">() =&gt;</span>{
<span class="hljs-comment">// You should call your hook function here and declare it here</span>
<span class="hljs-keyword">const</span> [testing, setTesting] = useState()

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">hello</span>(<span class="hljs-params"></span>)</span>{
<span class="hljs-comment">// Don't call Hooks in nested function in your components</span>
}

<span class="hljs-keyword">for</span>(<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i&lt;=<span class="hljs-number">10</span>; i++){
<span class="hljs-comment">// Don't call Hooks in loops</span>
}


<span class="hljs-keyword">return</span> <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span> Rules of Hooks <span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span></span>

}

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> hooksRule
</code></pre>
<ul>
<li>Only call Hooks from <strong>React function components</strong>:  Don’t call Hooks from regular JavaScript functions. Hooks are functions but it is also a React feature and should strictly be used and called in a <strong>React function components</strong>. See the code example below</li>
</ul>
<pre><code class="lang-JavaScript">
<span class="hljs-keyword">const</span> notAReactComponent = <span class="hljs-function">() =&gt;</span>{
<span class="hljs-comment">// You should not call your hook function here</span>

<span class="hljs-keyword">const</span> [testing, setTesting] = useState() 

<span class="hljs-comment">// This is wrong and would not work</span>

}

<span class="hljs-keyword">const</span> hooksRule = <span class="hljs-function">() =&gt;</span>{
<span class="hljs-comment">// You should call your hook function here and declare it here </span>
<span class="hljs-comment">// within your React Function Components</span>
<span class="hljs-keyword">const</span> [testing, setTesting] = useState()


<span class="hljs-keyword">return</span> <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span> Rules of Hooks <span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span></span>

}

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> hooksRule
</code></pre>
<p>Those are the rules of hooks when calling them, luckily React even provides a <a target="_blank" href="https://eslint.org/">(ES Lint)</a>linter plugin to check and alert you when you break these rules.</p>
<h2 id="the-usestate-react-hook">The useState React Hook</h2>
<p>State Hooks used as "useState" in React is a hook that is used to store local state in React after every render of a function component. You call this hook and set a state to it and it returns an array of two things; first,  the current state value and a function to update the value.</p>
<p>In JavaScript, when functions are called they create an execution context where the code is executed. After that, the function is destroyed and all it's state is lost except the data returned using the <code>return</code> keyword in JavaScript. </p>
<p>The same concept applies here with React as its features as I stated from the beginning are strongly tied to JavaScript. </p>
<blockquote>
<p>State in React is a posh word for data/value used in an application, this could be a value in variable or information gotten from forms e.t.c</p>
</blockquote>
<p>A React function component when executed and re-rendered would lose states that are present, to solve this, React has a feature called State Hooks that gives us the ability to store and preserve these states across React even after many re-render and execution.</p>
<h3 id="how-to-use-state-hooks">How to use State Hooks</h3>
<p>The "useState" Hook being a function accepts only one argument and that is the initial value of the state, the initial value can be any data type; numbers, strings, arrays, or object depending on what you are building and why you need it, and the useState hook returns an array of the current state value and a function to update it which can be called in an event listener or anywhere else within the function component. </p>
<p>Below is an example of useState in action, the example is a counter that increments every time a button is clicked.</p>
<pre><code class="lang-JavaScript"><span class="hljs-keyword">const</span> updateCounter = <span class="hljs-function">() =&gt;</span>{
<span class="hljs-comment">// Call the useState hooks</span>
<span class="hljs-keyword">const</span> [counter, setCounter] = useState(<span class="hljs-number">0</span>)

<span class="hljs-keyword">return</span> <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
 <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Number of times the button was clicked: {counter} <span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">onClick</span>=<span class="hljs-string">{</span> ()=&gt;</span> setCounter(counter + 1)}&gt; 
Click me to increase counter 
<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>

<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
}
</code></pre>
<p>in the code snippet above, when the button is clicked, the <code>setCounter</code> function is called and the new state value is passed and the <code>counter</code> state is updated which also reflect in the <code>p</code> tag.</p>
<p><strong>Array Destructuring</strong></p>
<p>You may probably noticed how the useState was used above and how the value was stored using the square bracket syntax. The syntax has nothing to do with React but JavaScript, the syntax is called <strong>array destructuring</strong>, which is a way we set each value of an array into a variable.</p>
<p>As explained earlier, the useState hook <code>returns</code> an array of two things, the current state and a function to update it, and we need to store these <code>returned values</code> in a variable to be able to use them, hence we destructure the <code>returned array</code> and store each value in a separate variable, hence the syntax.</p>
<pre><code class="lang-JavaScript"><span class="hljs-keyword">const</span> [counter, setCounter] = useState(<span class="hljs-number">0</span>)
</code></pre>
<p>To get more context on array destructing, you can read this article <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment">here</a>.</p>
<p>That is all about the State hooks and how it is used with the JavaScript features it utilizes. We use it to store states in React so we can access them after each re-render without losing the value of that state.</p>
<h2 id="conclusion">Conclusion</h2>
<p>We are at the very end of this article, I really do hope you enjoyed the article. </p>
<p>The next article on this React Hook series would be on the Effect Hook and how it can be used, so follow me to get notified when it gets posted.</p>
<p> If you did learn something please like, share, comment, just do anything to make it go viral. </p>
<p>If you have any questions concerning Go, Javascript, TailwindCSS, Open-source, or this article? You can reach me on <a target="_blank" href="https://twitter.com/DeveloperAspire">Twitter</a>. Till next time, see ya. Thank you.</p>
]]></content:encoded></item><item><title><![CDATA[Understanding the `reduce()` array method in JavaScript]]></title><description><![CDATA[Array methods in JavaScript are a bunch of amazing higher-order functions that help us iterate over an array while performing certain transformations or…]]></description><link>https://developeraspire.hashnode.dev/understanding-the-reduce-array-method-in-javascript</link><guid isPermaLink="true">https://developeraspire.hashnode.dev/understanding-the-reduce-array-method-in-javascript</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Functional Programming]]></category><category><![CDATA[newbie]]></category><dc:creator><![CDATA[Franklin Okolie]]></dc:creator><pubDate>Mon, 02 Aug 2021 09:38:22 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1626966610886/vi6wFVKMm.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Array methods in JavaScript are a bunch of amazing higher-order functions that help us iterate over an array while performing certain transformations or computations on each of the array items. </p>
<p>It also helps us construct our code in a more elegant way and easy-to-read pattern. We can use array methods to get our code looking more beautiful and easy to read, some of those functions are quite easy to understand while the others are a bit harder to grasp.</p>
<p>In this article, I will be explaining the <code>reduce()</code> array method, how it is used, and when you should use it.</p>
<h2 id="what-is-the-reduce-array-method-in-javascript">What is the  Reduce array method in JavaScript</h2>
<p>The <code>reduce()</code> array method is a higher-order function that takes an array and reduces it to one value. The value may be a number, string, object e.t.c.</p>
<p>The <code>reduce()</code> array method accepts two arguments:</p>
<ul>
<li><strong>The reducer function (Which you provide)</strong>: This is a function that runs on every iteration of the array</li>
<li><strong>Initial value</strong>: This is the initial value that you set for the iteration. Further down in this article I will explain how this is used.</li>
</ul>
<pre><code>array.reduce(  <span class="hljs-function"><span class="hljs-params">()</span>=&gt;</span>{},     <span class="hljs-number">0</span>)
</code></pre><p>The reducer function which is provided also accepts 4 arguments:</p>
<ul>
<li><strong>Accumulator</strong>: This holds the current value that is returned after each iteration</li>
<li><strong>current value</strong>: This is the current item in the array during the iteration</li>
<li><strong>index</strong>: This is the index of the current value (Optional)</li>
<li><strong>array</strong>: This is the original array on which the reduce method was called (Optional)</li>
</ul>
<p>How you name the arguments are totally up to you , the only thing that matters is the order which the arguments appear</p>
<pre><code><span class="hljs-keyword">array</span>.reduce( (accumulator, currentvalue, <span class="hljs-keyword">index</span>, <span class="hljs-keyword">array</span>)=&gt;{ 
// <span class="hljs-keyword">return</span> a <span class="hljs-keyword">value</span> here}, <span class="hljs-number">0</span>   )
</code></pre><h3 id="example-1">Example 1</h3>
<p>The example below is using the <code>reduce</code> array method to reduce all the numbers in an array into one single number by adding them all up</p>
<pre><code><span class="hljs-keyword">const</span> numbers = [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>];

<span class="hljs-keyword">const</span> sumOfNumbers = numbers.reduce(<span class="hljs-function">(<span class="hljs-params">accumulator, currentValue</span>)=&gt;</span>{
 <span class="hljs-keyword">return</span> accumulator + currentValue
}, <span class="hljs-number">0</span>)

<span class="hljs-built_in">console</span>.log(sumOfNumbers) <span class="hljs-comment">// 15</span>

<span class="hljs-comment">// you can store your reducer function in a variable to</span>
<span class="hljs-comment">// make your code neater and more readable</span>


<span class="hljs-keyword">const</span> reducerFn = <span class="hljs-function">(<span class="hljs-params">accumulator, currentValue</span>)=&gt;</span>{
 <span class="hljs-keyword">return</span> accumulator + currentValue
}

<span class="hljs-keyword">const</span> sumOfNumbers = numbers.reduce(reducerFn, <span class="hljs-number">0</span>)

<span class="hljs-built_in">console</span>.log(sumOfNumbers) <span class="hljs-comment">// 15</span>
</code></pre><p>In the code snippet above, the initial value is 0 which becomes the <code>accumulator</code> value at the start f the iteration, then <code>currentValue</code> becomes 1 which is the first element on the array. The <code>return</code> value becomes the addition of the <code>accumulator</code> plus <code>currentValue</code> which is <code>0 + 1 = 1</code>. </p>
<p>   Remember the <code>accumulator</code> holds the value returned from the function, so after the first iteration the <code>accumulator</code> now holds 1 which is the returned value. </p>
<p><strong>Note</strong>: The <code>accumulator</code>  holds the initialValue provided during the first iteration but after that, the <code>accumulator</code> now holds the returned value.</p>
<p>For every iteration from the example above, the array is reduced by adding the numbers in the array.</p>
<p>Let look at another example of how the <code>reduce()</code> method is used.</p>
<h3 id="example-2">Example 2</h3>
<p>In this example, <code>reduce()</code> is used to transform an array into a single object that shows how many times each string in the array appears</p>
<pre><code><span class="hljs-string">const</span> <span class="hljs-string">animalCounts</span> <span class="hljs-string">=</span> <span class="hljs-string">animals.reduce((obj,</span> <span class="hljs-string">pet)=&gt;</span> {
    <span class="hljs-string">if(obj</span>[<span class="hljs-string">pet</span>]<span class="hljs-string">)</span>{
     <span class="hljs-string">obj</span>[<span class="hljs-string">pet</span>] <span class="hljs-string">++</span>
  }<span class="hljs-string">else</span>{
      <span class="hljs-string">obj</span>[<span class="hljs-string">pet</span>]<span class="hljs-string">=1</span>
    }
<span class="hljs-string">return</span> <span class="hljs-string">obj</span>
}<span class="hljs-string">,</span> { }<span class="hljs-string">)</span>

<span class="hljs-string">console.log(animalCounts)</span>
<span class="hljs-string">//</span> <span class="hljs-string">Output</span>
{
<span class="hljs-attr">Dog:</span> <span class="hljs-number">3</span>,
<span class="hljs-attr">Sheep:</span> <span class="hljs-number">1</span>,
<span class="hljs-attr">Duck:</span> <span class="hljs-number">2</span>,
<span class="hljs-attr">Fish:</span> <span class="hljs-number">2</span>

}
</code></pre><p>In the code snippet above, you can see how I set the initial value to an empty object, this is be passed into the <code>accumulator</code> argument in the reducer function as the first value during the first iteration, from the example above is named <code>obj</code>. The for every iteration, that function is executed.</p>
<p>It checks if <code>obj</code> has a property of the <code>currentValue</code>, if it does it increase the property value , else it creates and new property with the name of the <code>currentValue</code> and assign <code>1</code> to it, which will be increased on every iteration if found again in the iteration.</p>
<p>That all there is to the <code>reduce()</code> method, it is very helpful in solving problems related to array and you can solve such problems neatly and elegantly. </p>
<h1 id="conclusion">Conclusion</h1>
<p> Thank you for sticking with me up till this point. If you enjoyed reading this article, please like and share it. </p>
<p> Have any questions? Drop them in the comment section below.</p>
<p>I would be posting more articles, so be sure to follow me to get notified when I post them.</p>
<p>If you have any questions concerning Go, Javascript, TailwindCSS, Open-source, or this article? You can reach me on <a target="_blank" href="https://twitter.com/DeveloperAspire">Twitter</a>. Till next time, see ya. Thank you.</p>
]]></content:encoded></item><item><title><![CDATA[JavaScript Built-in Functions VS Web Browser APIs]]></title><description><![CDATA[Learn the difference between JavaScript built-in functions and Web Browser APIs]]></description><link>https://developeraspire.hashnode.dev/javascript-built-in-functions-vs-web-browser-apis</link><guid isPermaLink="true">https://developeraspire.hashnode.dev/javascript-built-in-functions-vs-web-browser-apis</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[beginner]]></category><category><![CDATA[webdev]]></category><dc:creator><![CDATA[Franklin Okolie]]></dc:creator><pubDate>Wed, 09 Jun 2021 10:39:31 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1623226483202/J_G2v1c_G.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>How often do you confuse some Web Browser APIs to mean JavaScript built-in functions? JavaScript is a language that is complex and at the same time stupidly simple and plain that there are some funny things about it that developers don't know about it because it is masked as "Simple", but hey simple doesn't mean it is easy to learn and master.</p>
<p> In this article, I will be explaining some of the Web browser APIs Frontend developers use when building applications that have mistaken to be JavaScript built-in functions and why these APIs have been mistaken for JavaScript built-in functions. When I mean mistaken, I do mean many JavaScript developers don't know these functions are not JavaScript native functions but only made available by the browser windows object.</p>
<h2 id="what-is-even-javascript">What is even JavaScript?</h2>
<p>Well, JavaScript is a programming language used to give commands and instructions to a computer, and such computers include Servers, Browsers e.t.c. JavaScript is widely accepted and used by the tech community as the language for the browser, which is what sets it apart amongst others. </p>
<p>JavaScript has a very unique feature of being able to interact with a web browser, commands it, and give it instructions. The invention of JavaScript made web applications more lively and very interactive, and of course, the only language used for building applications that runs in the browser.</p>
<p>Its usage on the browser for years is what brought about the confusion on its features with that of the browser which is the aim of this article; to clarify JavaScript developers especially those starting to learn this awesome language.</p>
<h2 id="what-are-javascript-built-in-functions">What are JavaScript built-in functions?</h2>
<p>JavaScript built-in functions are already-made functions or native functions that come with the language JavaScript developers can use in building whatever they want. Yeah, it is that simple.</p>
<p>Just like in any other programming language, Functions are blocks of code that solve a particular problem or provides a particular solution, and the fun thing is functions can and are made to be reusable anywhere in an application. This also applies to built-in functions, they are made available globally by the language in this case JavaScript. </p>
<p> <strong>10 Built-in JavaScript functions:</strong></p>
<ul>
<li>split() - Turns a string to an Array.</li>
<li>splice() - Splicing strings by index.</li>
<li>reverse() - Reverse an array.</li>
<li>join() - Convert an array to string.</li>
<li>toLowerCase() - Converts strings to lowercase.</li>
<li>toUpperCase() - Converts strings to Uppercase.</li>
<li>forEach() - Function to loop through arrays.</li>
<li>indexOf() - Finds the index of any data passed into it.</li>
<li>map() - Function that loops through an array and produces a new array from the old one.</li>
<li>filter() - Function used to filter through an array.</li>
</ul>
<p>The above are just fractions of the available built-in functions in JavaScript that developers can use provided by the  <a target="_blank" href="https://262.ecma-international.org/">EcmaScript organization</a>. They are available globally in JavaScript.</p>
<h2 id="what-is-web-browser-apis">What is Web Browser APIs?</h2>
<p>Before we dive into this, we need to understand what an API means in programming.</p>
<blockquote>
<p> "Application Programming Interfaces (APIs) are constructs made available in programming languages to allow developers to create complex functionality more easily. They abstract more complex code away from you, providing some easier syntax to use in its place." --  <a target="_blank" href="https://developer.mozilla.org/">The MDN</a> </p>
<p>Be aware that there are two types of APIs in the Browser which are; Browser API and Third-party APIs, but this article is about the Browser API. Read more about APIs  <a target="_blank" href="https://developeraspire.hashnode.dev/an-api-what-exactly-is-it">Here</a></p>
</blockquote>
<p><strong>So what is Web Browser APIs?</strong></p>
<p>Web Browser APIs are  APIs available in the browser that can be interfaced with(using JavaScript)  for building complex and hard applications, they are provided and exposed globally ready to be used, these APIs allow us to interact with the browser on a very much abstract level.</p>
<p> For example, the DOM API commonly used by Frontend Developers provides construct for creating HTML elements, deleting HTML elements, adding and removing classes on HTML elements, adding new HTML elements to the DOM, listening to events on HTML elements, and generally manipulating elements on the DOM tree of a browser. Beneath this API, your browser is using some low-level language to make this happen. But then, this is the abstraction the API does for you and the browser provides this API for you to use. </p>
<p><strong> 5 examples of Browser APIs:</strong></p>
<ul>
<li>DOM API</li>
<li>Web Audio API</li>
<li>Canvas API</li>
<li>History API</li>
<li>Touch Event API</li>
</ul>
<h2 id="web-browser-apis-mistook-to-be-javascript-built-in-functions">Web browser APIs mistook to be JavaScript built-in Functions</h2>
<p>Now we are here. But why are these APIs mistook to be JavaScript built-in Functions? Let's know why:</p>
<h3 id="language-of-the-browser"><strong> Language of the Browser </strong></h3>
<p>Just like I noted up above, JavaScript has been long accepted, used, improved to be the only language of the browser, I don't see any language replacing her in that aspect( TypeScript is still complied down to JavaScript). JavaScript has the ability to interface with this web browser's APIs because it was built to do that, even the browsers are aware of the capability of JavaScript being able to use the API they make available for use. </p>
<p>Through the constant usage of these APIs which look like a function,  e.g "addEventListener()", see the way they also use the naming convention of JavaScript( Camel casing) and functions parenthesis, these APIs have been seen and taken to be inbuilt functions of JavaScript, owing to how frequent they are been used and how dependent JavaScript is on them in order to make applications. Take away the ability for JavaScript to interface with these APIs and the APIs itself and JavaScript ceases to be a language of the browser. </p>
<p>So it is safe to say JavaScript and the Browser have some love relationship seeing the way they complement each other and work well and even the similarities between JavaScript functions and the web APIs.</p>
<p>Let take a look at a human example that explains how JavaScript and the Web Browser APIs works.</p>
<p>John is human in an environment with food, fresh air, good clothes. Our focus is on those three for now:</p>
<ul>
<li>Food: John is JavaScript and the Food here is a web API, John is not born with food ( in-built function) but born with the ability to consume any food in the environment( Browser) provides for him to function well in the same environment<ul>
<li>Fresh air( Oxygen): John is also not born with Fresh air in his lungs rather the ability to breathe the air the environment provides</li>
<li>Good Clothes: John is not born with clothing on his body but rather has a body that needs to be clothed. This can also be applied to housing too.</li>
</ul>
</li>
</ul>
<p><strong> Below are some of the APIs mistook to be JavaScript built-in functions:</strong></p>
<ul>
<li>Fetch(): JavaScript on its own cannot connect or talk to a third-party API, but the browser can so it provides an API that allows JavaScript to do the connecting.<ul>
<li>setTimeout(): I see no reason a programming language needs a timer to do anything but building an app you would need one in the browser, so there goes the browser to the rescue.</li>
<li>setInterval(): Same with the setTimeout.</li>
<li>AudioAPI(): JavaScript can't play audio on its own.</li>
<li>localStorage(): Please JavaScript doesn't have the ability to store things on a web browser database.</li>
<li>addEventListener(): This is a construct from the DOM API for adding a listener to an HTML element, it has nothing to do with JavaScript.</li>
</ul>
</li>
</ul>
<p>There are so much many more but I will stop here. Someone may ask "But we don't import them before use as we do in Golang or Python, so how are they not built-in?", well just like John in the environment, John doesn't need to request air before the environment gives it to him, as soon as John is born, Oxygen fills his nostrils and is left for him to breathe in and take it, So no need to import. I think the only time JavaScript needs "importing" is when using a module or external libraries. Knowing this is what sets you apart as an experienced JavaScript developer and makes you world-class because you really understand your domain.</p>
<h2 id="resources">Resources</h2>
<ul>
<li><a target="_blank" href="https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Client-side_web_APIs/Introduction">What are Web APIs</a> </li>
<li><a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/API#specifications">List Of Web Browser APIs</a> </li>
<li><a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects">Built-in JavaScript Objects</a> ( You need to know these too)</li>
<li><a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/API#interfaces">List of Web Browser APIs in Object</a> ( Object Interfaces)</li>
</ul>
<p>The resources above are provided that you may look further into these topics and arm yourself with more knowledge on this subject matter!</p>
<h1 id="in-conclusion">In conclusion</h1>
<p>Wow!! We are at the very end of this article, hope you learned a lot because I can't imagine how much you know after this article and that is what this blog is existing in the first place.</p>
<p> If you did learn something please like, share, comment, just do anything to make it go viral. </p>
<p>I would be posting more articles, so be sure to follow me to get notified when I post them.</p>
<p>If you have any questions concerning Go, Javascript, TailwindCSS, Open-source, or this article? You can reach me on <a target="_blank" href="https://twitter.com/DeveloperAspire">Twitter</a>. Till next time, see ya. Thank you.</p>
]]></content:encoded></item><item><title><![CDATA[Vue's Reactivity System, A Deep Dive]]></title><description><![CDATA[Hello there, welcome to my blog. Vue is such an interesting tool to work with, for the past couple of weeks I have spent a lot of time learning it, and not…]]></description><link>https://developeraspire.hashnode.dev/vues-reactivity-system-a-deep-dive</link><guid isPermaLink="true">https://developeraspire.hashnode.dev/vues-reactivity-system-a-deep-dive</guid><category><![CDATA[Vue.js]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Beginner Developers]]></category><dc:creator><![CDATA[Franklin Okolie]]></dc:creator><pubDate>Wed, 21 Apr 2021 10:30:53 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1618921891414/bvvnnm4Az.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello there, welcome to my blog. Vue is such an interesting tool to work with, for the past couple of weeks I have spent a lot of time learning it, and not just learning it, but learning the underlying concepts as this gives me an edge when using it. Understanding a framework behind the scenes is really interesting. Vue is fast and reacts to changes in data and updates the DOM with lightning speed, have you ever asked yourself why? Like yeah, why. Coming from JavaScript I have never seen anything like that. Well, Vue uses a programming concept called Reactive programming, which is what enables Vue reactivity system.</p>
<p>Sounds strange? Relax, the aim of this article is the demystify the Vue reactivity system and makes you understand what Vue does under the hood. Grab some popcorn, this would be fun trust me.</p>
<blockquote>
<p>Prerequisite</p>
<ul>
<li>Basic understanding of Vue.</li>
<li>Basic knowledge of JavaScript.</li>
</ul>
</blockquote>
<h2 id="what-is-reactive-programming">What is Reactive Programming?</h2>
<p> Reactive programming is programming with asynchronous data streams. </p>
<p>Yeah, that just it. Sounds funny? Typical click event, user inputs e.t.c are data streams, it can be anything from hover, variables, data structures, arrays, e.t.c. Now programming with these data streams is what is called Reactive programming. You can hook into any stage of the data streams.</p>
<p>A stream is a sequence of ongoing events ordered in time. For example, let take a look at a hover effect, there are 3 data streams there; the time the mouse hovers over it, the actions that take place after the hovering of the mouse, and when the mouse leaves, with reactive programming we can listen to that data stream and react accordingly.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1618996071958/eTQWnBYnH.png" alt="reactive.png" /></p>
<h2 id="how-does-vue-use-reactive-programming">How does Vue use Reactive programming?</h2>
<p>First off, frontend frameworks like React and Angular make use of reactive programming to react to data changes either from an API or from user activity, well that is what most of frontend development is focused on "reacting and interacting with the user".</p>
<p>Vue makes use of Reactive programming heavily when rendering data and attending to changes in data. When we write Vue code, we know the browser doesn't understand it, so what Vue does is to change that Vue code and style to native JavaScript and pass it for the browser to execute. Let look at how Vue converts a component to JavaScript.</p>
<p>In a Vue component, there is a data object that returns an object with properties that we can use in our templates.</p>
<pre><code class="lang-js"><span class="hljs-comment">// Vue </span>
&lt;template&gt;
   <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">h2</span>&gt;</span> {{ name }} <span class="hljs-tag">&lt;/<span class="hljs-name">h2</span>&gt;</span></span>
&lt;/template&gt;

<span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">script</span>&gt;</span>
export default {
data(){
return{
      name: "Mike Thompson",

}
},
method:{
sayHello(){
console.log("Good morning"+ this.name")
    }
}

}
<span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span></span>
</code></pre>
<p>The code above when executed by Vue is stored in a global object in the Virtual DOM, this will also include computed properties, life cycle hooks, watchers e.t.c and given to JavaScipt, now let see that. </p>
<pre><code class="lang-JS">
<span class="hljs-comment">// Vue converted to JavaScript</span>
<span class="hljs-keyword">const</span> <span class="hljs-built_in">global</span> = {
    <span class="hljs-attr">name</span>: <span class="hljs-string">"Mike Thompson"</span>,
   sayHello(){
   <span class="hljs-built_in">console</span>.log(<span class="hljs-string">" Good morning "</span>+ <span class="hljs-built_in">this</span>.name<span class="hljs-string">")
     }
}</span>
</code></pre>
<p>From the code, above you can see Vue made the function in the Vue <code>methods</code> an object method in the global object, ever wondered why the functions in Vue are referred to as <code>methods</code> just like the one in the above Vue code snippet, well here is why, because after the conversion to JavaScript they indeed become a JavaScript object method. Is this making sense?. Finally, in the Vue code snippet above you can see how the use of the <code>this</code> keyword was used to get values of the <code>object</code> property, this is because under the hood the <code>data</code> and the <code>methods</code> object are part of a global object, and in JavaScript, we use the <code>this</code> keyword to get values of the object properties.</p>
<p>So that is a breakdown of how Vue converts the code written to JavaScript, this will help us understand better how Vue uses Reactive programming to work. Read on.</p>
<p>A change in any of those data properties would update in the DOM with lightning speed since that part of the DOM uses the data value. But how does Vue does this? </p>
<ul>
<li>Detect if there is a change in any of the values.</li>
<li>Track the function to change it.</li>
<li>Trigger the function and update the value.</li>
</ul>
<p>All those happen under a millisecond, now the big question is what function is Vue tracking? how is it triggering the function? The first time, this was not making sense to me, but I am here to explain all of that. So take a deep breath, take a handful of your popcorn and let continue.</p>
<h3 id="javascript-is-not-reactive">JavaScript is not reactive.</h3>
<p>Let take a look at the code below: </p>
<pre><code class="lang-JS"><span class="hljs-keyword">let</span> message = <span class="hljs-string">"Hello"</span>
<span class="hljs-keyword">let</span> longMessage = message + <span class="hljs-string">' World'</span>
<span class="hljs-built_in">console</span>.log( longMessage)

<span class="hljs-comment">// 'Hello World'</span>

message = <span class="hljs-string">"Hello!!!!"</span>
<span class="hljs-built_in">console</span>.log( longMessage)

<span class="hljs-comment">// 'Hello World'</span>
</code></pre>
<p>See what happened right there? JavaScript didn't update the message variable, even when we clearly reassigned it. This is the issue Vue came to solve, from the code above we can agree that JavaScript is not reactive by default.</p>
<h3 id="how-vue-reacts-to-changes">How Vue reacts to changes</h3>
<p>Beneath the hood, Vue uses a JavaScript ES6 feature call Proxy wrap our global object( I discussed that above) to track changes and update the data values based on the changes.  Let see how the JavaScript Proxy works.</p>
<pre><code class="lang-JS"><span class="hljs-keyword">const</span> <span class="hljs-built_in">global</span>= {
  <span class="hljs-attr">name</span>: <span class="hljs-string">"Mike Thompson"</span>,
}

<span class="hljs-keyword">const</span> handler={
set(target, key, value){
<span class="hljs-built_in">console</span>.log(target)
<span class="hljs-built_in">console</span>.log(key)
<span class="hljs-built_in">console</span>.log(value)
  }
}

<span class="hljs-keyword">const</span> proxy = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Proxy</span>(<span class="hljs-built_in">global</span>, handler)

proxy.name = <span class="hljs-string">"James Bond"</span>
</code></pre>
<p>The Output: </p>
<pre><code class="lang-JS"><span class="hljs-comment">// { message: "Mike Thompson" }</span>
<span class="hljs-comment">// message</span>
<span class="hljs-comment">// "James Bond"</span>
</code></pre>
<p>Let me explain what is going on up there.</p>
<p>A JavaScript Proxy accepts two arguments; (the object to be tracked) and (the object to track it), the object used to track the change is called a <code>handler</code>. Now, in the <code>handler</code> object, we have 2 functions which are namely <code>get()</code> and <code>set()</code> which are called Traps. <code>get()</code> is used to get the data changed and what changes while <code>set()</code> just as the name implies is used to set the new value when the data is changed and it automatically provides 3 arguments we can use to set changes <code>target</code>, <code>key</code> and <code>value</code>. The <code>target</code> is the object where the change happened as we see above, the <code>key</code> is the object key where the change happened, while the <code>value</code> is what changed. From the output you can see that.</p>
<p>The Proxy wraps the "object to be tracked" and thereby gets access to the properties in that object, which means we can use the Proxy to change the value of properties as we want which I did above, and the handler on it part <code>gets</code> these changes and <code>sets</code> them. From the output of the code snippet above, you can see the value of the <code>name</code> property changed. </p>
<p>To make this more clear, let's have another code snippet. </p>
<pre><code class="lang-JS"><span class="hljs-keyword">const</span> <span class="hljs-built_in">global</span>= {
  <span class="hljs-attr">message</span>: <span class="hljs-string">" Hello "</span>,
 <span class="hljs-attr">longMessage</span>: <span class="hljs-string">"Hello!! World"</span>
}

<span class="hljs-keyword">const</span> handler={
set(target, key, value){

  }
}

<span class="hljs-keyword">const</span> proxy = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Proxy</span>(<span class="hljs-built_in">global</span>, handler)
</code></pre>
<p>From the above snippet, what I want to achieve is to make <code>longMessage</code> change when the <code>message</code> property changes. Let do that, oops take a handful of popcorn.</p>
<pre><code class="lang-JS"><span class="hljs-keyword">const</span> <span class="hljs-built_in">global</span>= {
  <span class="hljs-attr">name</span>: <span class="hljs-string">"Hello"</span>,
}

<span class="hljs-keyword">const</span> handler={
set(target, key, value){
  <span class="hljs-keyword">if</span>(key === <span class="hljs-string">' message '</span> ){
     target.longMessage = value + <span class="hljs-string">' World '</span>
}
 target.message = value;
  }
}

<span class="hljs-keyword">const</span> proxy = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Proxy</span>(<span class="hljs-built_in">global</span>, handler)

proxy.message= <span class="hljs-string">"Hy"</span>

<span class="hljs-built_in">console</span>.log ( proxy.longMessage)
</code></pre>
<p>Output : </p>
<pre><code class="lang-JS">
<span class="hljs-comment">// "Hy World"</span>
</code></pre>
<p>I know that is a lot of code, but let me explain what is going on there, I asked the <code>set</code> function to watch if what I am changing has the property of <code>message</code>,  if yes,  I want the longMessage to take the new <code>value</code> and attach to " World ". Then I reassign the <code>message</code> property to take the new <code>value</code>.</p>
<p>So when we changed the value of the <code>message</code> property using the <code>proxy</code> the <code>handler</code> fired the <code>set</code> function and updated the necessary things, now this brings us back to the solution on how Vue tracks and updates data changes:</p>
<ul>
<li>Detect if there is a change in any of the values.</li>
<li>Track the function to change it.</li>
<li>Trigger the function and update the value.</li>
</ul>
<p>Vue wraps the global object with a Proxy and makes a <code>handler</code> that tracks those changes and updates them in accordinly. </p>
<p>You have seen how Vue uses the Proxy feature to track changes and updates the data based on the changes, now imagine writing all that code for your JavaScript application? That would be strenuous and give us a messy codebase and we will have to track different object properties and react to them. But here you go, Vue is doing that for us under the hood, using the Reactive programming concept as it enables us to program and run codes based on data streams and events. </p>
<p>The objective of this article is not for you to ram up those codes or start writing Proxy, nope but rather to make you understand how Vue uses the JavaScript proxy to achieve its Reactive nature and any day you may want to dabble into the Vue codebase to make open-source contributions, you can probably understand how the codes are written.</p>
<h2 id="resources">Resources</h2>
<ul>
<li><a target="_blank" href="https://gist.github.com/staltz/868e7e9bc2a7b8c1f754">The introduction to Reactive Programming you've been missing</a>.</li>
<li>[ Introduction to Reactive Programming] (https://app.egghead.io/lessons/rxjs-understand-reactive-programming-using-rxjs?pl=introduction-to-reactive-programming)</li>
</ul>
<h1 id="in-conclusion">In conclusion</h1>
<p>With this knowledge, you should have an understanding of Reactive programming and how the Vue reactivity system works. Hope you grabbed something? and did you finish your popcorn?</p>
<p>So we have come to the end of this amazing article. Hope you learned something useful. If you did, like, share, comment, just do anything to make it go viral. </p>
<p>I would be posting more articles, so be sure to follow me to get notified when I post them.</p>
<p>If you have any questions concerning Go, Javascript, TailwindCSS, Open-source, or this article? You can reach me on <a target="_blank" href="https://twitter.com/DeveloperAspire">Twitter</a>. Till next time, see ya. Thank you.</p>
]]></content:encoded></item><item><title><![CDATA[Computed properties VS Methods VS Watchers in Vue]]></title><description><![CDATA[Hello there, welcome back to my blog. Frontend engineering has long been perceived as a path for people who love design and CSS, and I clinched to this…]]></description><link>https://developeraspire.hashnode.dev/computed-properties-vs-methods-vs-watchers-in-vue</link><guid isPermaLink="true">https://developeraspire.hashnode.dev/computed-properties-vs-methods-vs-watchers-in-vue</guid><category><![CDATA[Vue.js]]></category><category><![CDATA[Frontend Development]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[Web Development]]></category><dc:creator><![CDATA[Franklin Okolie]]></dc:creator><pubDate>Sat, 03 Apr 2021 11:29:57 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1623236186597/_8lrii9It.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello there, welcome back to my blog. Frontend engineering has long been perceived as a path for people who love design and CSS, and I clinched to this belief. Still, recently all those beliefs are gradually changing as Frontend engineering now involves more logic and critical thinking but thanks to all the frontend frameworks that have come to our aid. One of those frameworks is Vue, a progressive frontend framework for building powerful, single-page applications. Learning a framework comes with many struggles, including learning the underlying principles of using that framework and learning the terms and functions of the framework, which aids how we use it. Learning Vue came with many struggles for me because I was entering a new convention of building things and not the usual one I am used to.</p>
<p>Some of the terms I would be explaining in this article are:</p>
<ul>
<li>Methods.</li>
<li>Computed Properties.</li>
<li>Watchers.</li>
</ul>
<p>These three terms in Vue confused me a lot when I started learning, so I promised to write an article explaining it for someone who may be facing the same issues I faced too when learning, the three of them are so similar that it causes some kind of confusion on how to use them in our application but I got to understand their similarities and differences which is what I will be explaining in this article. This article is written with a basic explanation that anyone can understand. So grab the popcorn, and let enjoy.</p>
<blockquote>
<p>In my last article on Vue, I explained the Vue folder structure <a target="_blank" href="https://developeraspire.hashnode.dev/understanding-vue-folder-structure">here</a>.</p>
</blockquote>
<h2 id="methods">Methods</h2>
<p>Methods in Vue is simply an object in Vue where we pass in object functions that perform specific logic in our applications, there are just like a container where we write functions that get executed in Vue, just like the normal function in JavaScript. Below is a function in a methods object that returns the value of two numbers.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1617443971946/reS_3tcl0.png" alt="methods.png" /></p>
<h2 id="computed-properties">Computed Properties</h2>
<p>Computed Properties in Vue is similar to methods in the sense that it is also an object in Vue where we write functions that get executed in Vue. Computed properties are cached unlike methods, they are used to make large computations that we want to happen in an instant, they are part of the Vue reactive nature. Don't worry if this sounds strange, further down the article, I would explain the differences between them and where, when they are best used. So read on. Below is a computed property that adds two numbers.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1617447221550/UxWdwy3pF.png" alt="computed.png" /></p>
<h2 id="watchers">Watchers</h2>
<p>Watchers in Vue is a property that we can use to watch any data for updates and perform certain actions we want with the change in data or state. Very similar to computed properties but with a difference. Below is an example, I set a watcher to watch the 'name' property on the data object, and when the value on the property changes, I want it to console log 'Hello'. That is a typical example of what watchers do. Just as its names implies, they simply watch.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1617446991776/di2WIL_d2.png" alt="watchers.png" /></p>
<h1 id="the-similarities-between-the-three">The Similarities Between The Three.</h1>
<ul>
<li>Methods, Watchers, and Computed properties are all object that accepts functions.</li>
<li>Watchers and Computed properties are part of the Vue reactivity system.</li>
<li>Methods and Computed properties can be used in HTML with the interpolation syntax <code>( {{ }} )</code></li>
</ul>
<h1 id="the-differences-between-the-three">The Differences Between The Three</h1>
<ul>
<li>Computed Properties: These are like methods but they don't react to user activity or event, but they react if there is any change in the data property they are connected to or depends on. If anything on the page gets changed, it doesn't care, it only changes if the data it is chained to get changed. It is good for making large computations as it does not renders every time the pages change rather when the data it is connected to does change. They are cached for better performance. There are used in Data Binding and Interpolation. So where can we use them? Imagine having a large list of 1 million attendees that registered for an event and you want users to be able to sort users based on age or date of registration. This is where computed properties shine a lot. Using Methods will affect the performance of web app but with Computed properties, the list is cached and only update when anything in the list changes.</li>
</ul>
<blockquote>
<p>Check this <a target="_blank" href="https://codepen.io/sdras/pen/9405ba833415572d34ec7c3ba13b1608">example</a> and this <a target="_blank" href="https://vue-jfdp3c.stackblitz.io/">example</a>. The first example is a list that users can filter based on labels, while the second is a calculator that calculates instantly when any of the values changes.</p>
</blockquote>
<ul>
<li><p>Methods Functions: These are better when we want to react to user activity or event for the page to re-render like for a click and submit not for making instant changes and reactive computations. Methods are not used for computations because they get called every time anything on the page changes. In order words using them with interpolation causes them to get called every time there is a general change anywhere on the page. They are best used in Event Binding. So where can they be used? Form submissions, Form validations e.t.c. Because all these require the users to fire an event, and that is when the methods get called on.</p>
</li>
<li><p>Watchers: Though work like computed properties, when used to do what computed properties do. They are mostly used to update the DOM or perform certain logic when a certain condition is met, see them as the if/else of the Vue reactive system.</p>
</li>
</ul>
<p>The concepts of watchers and computed properties boils down to Reactive programming, which means programming with the change in state or data of the DOM.</p>
<h2 id="resources">Resources</h2>
<ul>
<li><a target="_blank" href="https://gist.github.com/staltz/868e7e9bc2a7b8c1f754">The introduction to Reactive Programming you've been missing</a>.</li>
<li>[ Introduction to Reactive Programming] (https://app.egghead.io/lessons/rxjs-understand-reactive-programming-using-rxjs?pl=introduction-to-reactive-programming)</li>
</ul>
<h1 id="in-conclusion">In conclusion</h1>
<p>With this knowledge, you should have an understanding of the meaning, similarities and differences and what they do, which would aid in mastering Vue and navigating and fixing bugs like a pro</p>
<p>So we have come to the end of this amazing article. Hope you learned something useful. If you did, like, share, comment, just do anything to make it go viral. </p>
<p>I would be posting more articles, so be sure to follow me to get notified when I post them.</p>
<p>If you have any questions concerning Go, Javascript, TailwindCSS, Open-source, or this article? You can reach me on <a target="_blank" href="https://twitter.com/DeveloperAspire">Twitter</a>. Till next time, see ya. Thank you.</p>
]]></content:encoded></item><item><title><![CDATA[Understanding Vue folder structure]]></title><description><![CDATA[Hello there, welcome to my blog. Learning new tools comes with the pains of learning new concepts about the chosen tool, and it may be different from the…]]></description><link>https://developeraspire.hashnode.dev/understanding-vue-folder-structure</link><guid isPermaLink="true">https://developeraspire.hashnode.dev/understanding-vue-folder-structure</guid><category><![CDATA[Vue.js]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[javascript framework]]></category><dc:creator><![CDATA[Franklin Okolie]]></dc:creator><pubDate>Tue, 09 Mar 2021 16:45:49 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1623236209380/qidfUFf_b.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello there, welcome to my blog. Learning new tools comes with the pains of learning new concepts about the chosen tool, and it may be different from the normal convention a developer is used to. The tool I would be discussing in this article is Vue, which is a Frontend framework for building single-page applications. The first time I installed Vue via CLI, I was blown by the folder structure and their names and what the hell they do, this was because I was coming from a different background and here I am learning a new tool and am sure there is someone out there who feels the same. If you are that person, just relax it is normal, with every tool or framework we learn, there are some certain rules that guide how we use them, and this article will explicitly explain the Vue folder structure.</p>
<blockquote>
<p>Prerequisites</p>
<ul>
<li>Basic Understanding of JavaScript to help you understand.</li>
<li>Your mind and heart</li>
</ul>
<p><strong>You are going to learn</strong>:</p>
<ul>
<li>The meaning of each folder and file Vue provides</li>
<li>The functions of the folder and how they affect your Vue app</li>
</ul>
</blockquote>
<h1 id="what-is-vuejs">What is Vue.js?</h1>
<p>Vue is a progressive frontend framework for building fast, scalable and single-page applications. Vue is one of the top three frameworks in demand. Vue is also open-source built by Evan You. I personally love Vue for its learning curve, it took me less than 1 day to grasp Vue.</p>
<p>Vue comes with two different ways of using and installing it, you can use Vue to control some part of your application, and in this way, you can use Vue via CDN, see the <a target="_blank" href="https://v3.vuejs.org/guide/installation.html#release-notes">documentation</a> on how it is done. You can also use Vue by making it control your full application and this way, you have to install it via CLI, and Vue automatically set up a project for you, installs all the dependencies needed for your project to run, set up the project folder for you also. Isn't that lovely? I call it ease of programming, just a single command, and all these are done for you. But the problem that comes with this is understanding the folder structure because just like every other tool and framework out there, Vue has a structured pattern it believes is the best way for you to write your app. This is the point where most newbie gets thrown off, I was thrown off myself, but this article is here to guide you and even if you don't fully understand it but decided to cramp it up, this article will clarify you. Let dive in.</p>
<h1 id="after-installing-vue">After Installing Vue</h1>
<p>Once your Vue project has been set up by Vue and after you have opened it in your preferred code editor, it should look like this: </p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1615303375731/ZP0P4pbVs.png" alt="vue-StackBlitz.png" /></p>
<p>Now let's understand what is going on here.</p>
<h3 id="nodemodules-folder">Node_Modules Folder</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1615303519061/kwBnIVGam.png" alt="node-module.png" /></p>
<p>Vue is a JavaScript Framework and all JavaScript frameworks and libraries rely on NPM(Node package manager) to manage, store and host their different dependency, as long as you are using JavaScript, npm is inevitable. So what are node_modules and why should you care?.</p>
<p>Node_Modules is a folder that contains all the source codes, dependencies, settings, and configurations that your preferred tool is using to ensure it works smoothly, the good news is you don't have to worry or touch your node_modules folder, it is just there to make sure your tools have the dependencies it needs to run smoothly, as you install new tools to your project, node_modules automatically update and stores the source codes, dependencies, settings, and configurations your new tool needs to run. The command <code>npm install &lt;whatever&gt;</code> is referring to the NPM and asking it to bring whatever tools you wish to install and its source codes, dependencies, and these dependencies get stored in the node_modules folder. Just see it as a storehouse for your tool's settings and configuration. Nothing to worry about.</p>
<h3 id="public-folder">Public Folder</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1615304172139/2ItpZqcwdl.png" alt="public.png" /></p>
<p>The public folder is where Vue keeps the index.html file that is being run in the browser, inside the index.html file is basic HTML markup that we are all used to, this is why Vue is used to build single-page apps because there is only one HTML file which is the index.html, every other page, which is called Components in Vue are dynamically injected to this index.html file by Vue.</p>
<blockquote>
<p>Learn more about single-page applications by reading this article <a target="_blank" href="https://developeraspire.hashnode.dev/what-is-a-single-page-application">here</a> </p>
</blockquote>
<h3 id="src-folder">SRC Folder</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1615304609596/q7DERlWDI.png" alt="src.png" /></p>
<p>Next up is the src folder, the source folder is where we write our source code for our Vue app, inside the src folder, we have the: assets folder, components folder, App.vue file, and main.js file</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1615304798965/EB4v5gb7A.png" alt="opensrc.png" /></p>
<p>Let me explain them one after the other. The assets folder are where we keep our asset for a project which may include logos, Icons, SVG icons e.t.c, the components folder is where we write our various Vue code that is grouped in files with the .vue file extension.</p>
<p>Components in Vue are parts of the application written in different files so they can be accessible, resued, and also give us a clean codebase, they contain HTML markup, JavaScript code, and CSS styling. For example, an E-commerce app can have header components that contain the header markup and styling, and also the product's components that display products, then it can also have the sidebar components. Now all these components are created in the components folder inside the src folder and then are used in the App.vue file which is the root components that collect and use all the components created.</p>
<p>Now down to the main.js file, you may be wondering, since we are writing a Vue app, what is main.js still doing there? Well, the truth is Vue is just doing all the hard work for us and allowing us to focus on building, instead of worrying about scalability and connecting and organizing our JavaScript files but this doesn't mean that the browser understands what Vue is doing, the browsers only understand one way of building frontend, which is to have an HTML file, JavaScript file where all the scripting are written and a styling file, that is all the browser wants to hear. Now Vue just uses the main.js file to import all the vue code, turn them into native JavaScript and render it to our browser, Vue has done its job, we are happy and the browser is happy too. The image below shows how Vue imports the vue code.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1615305701743/50z6hQnR3.png" alt="main.png" /></p>
<p>From the first line of code, Vue is using the destructing syntax to store the Vue objects named <code>createApp</code> as it <code>requires</code> it from vue, which is stored in the node_modules folder, remember I said that the node_modules folder contains all the source codes and dependencies a framework has? Good.
Second-line JavaScript is importing the App.vue root components into the main.js and also remember the App.js file is what contains all the components we need for our full application.</p>
<p>Now that JavaScript has the variable <code>createApp</code> which contains Vue objects, the main.js file now has access to the methods in that object and uses the .mount() method to tell JavaScript where to inject the vue code which by now has been converted to native JavaScript, HTML, and CSS so the browser can understand. And this mount() method accepts a parameter which is the element that would receive the code and styling. Which in this case is a <code>div</code> which an <code>id</code> of #app written in the index.html file and then injects the App components which was imported on line two into this HTML div.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1615306535429/E2zx-zOXo.png" alt="index.png" /></p>
<p>See how Vue runs behind the scenes? Amazing right. You can see the pipeline of functionalities and logic Vue undertakes to make sure our app works fine, which in turn makes developers happy people.</p>
<h3 id="gitignore-file">Gitignore file</h3>
<p>Well, this should be familiar to developers using git. The gitignore file is where we tell Git what files and folder that should be ignored and not pushed to our remote repository, which may be Github, Bitbucket, Gitlab e.t.c </p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1615307024384/2u4rCW9hg.png" alt="git.png" /></p>
<p>Vue in all her wisdom already knows what files and folders should not be pushed and has specified them in that file, and of course, you can also add your own file as you advance to building your project with vue.</p>
<h3 id="babel-config-file">Babel Config file.</h3>
<p>I mentioned above that Vue converts our component's code which we wrote in vue style into native JavaScript, and Babel is responsible for this, Babel goes as far as converting our advanced and Vue way of writing JavaScript to a backward version of JavaScript that all browsers can understand because browsers don't know and also don't care what Vue is, they just want JavaScript, also most browsers are yet to understand ES6+, so Babel does the hard work.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1615307024384/2u4rCW9hg.png" alt="git.png" /></p>
<h3 id="packagejson-file">Package.json File</h3>
<p>This file keeps track of all our dependencies that our projects using, names of our projects, the scripts needed to run our projects e.t.c. You can use it to check if a package you installed is truly present, and also see the dependencies your app is running on</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1615307912140/kBNDKNrpU.png" alt="package.png" /></p>
<p>From the image above, we can see that the file is showing us that vue is installed as a dependency of that project.</p>
<h3 id="package-lockjson-file">Package-lock.json File</h3>
<p>The package-lock.json file is the big brother of package.json it gives more details and a closer look at the version of our project, the dependencies of the tools we are using, the settings, date, configuration e.t.c. Just like the node_modules folder, this is the NPM business and is auto-generated, you need not touch it, in fact looking at it can give you a headache. Lol</p>
<h1 id="in-conclusion">In conclusion</h1>
<p>With this knowledge, you should have an understanding of the Vue folder structure and what they do, which would aid to to mastering Vue and navigating and fixing bugs like a pro</p>
<p>So we have come to the end of this amazing article. Hope you learned something useful. If you did, like, share, comment, just do anything to make it go viral. </p>
<p>I would be posting more articles, so be sure to follow me to get notified when I post them.</p>
<p>If you have any questions concerning Go, Javascript, TailwindCSS, Open-source, or this article? You can reach me on <a target="_blank" href="https://twitter.com/DeveloperAspire">Twitter</a>. Till next time, see ya. Thank you.</p>
]]></content:encoded></item><item><title><![CDATA[What is a Single-page Application?]]></title><description><![CDATA[Hello there, welcome to my blog. I am always happy to share my knowledge and as well educate other developers out there about some concepts that they have…]]></description><link>https://developeraspire.hashnode.dev/what-is-a-single-page-application</link><guid isPermaLink="true">https://developeraspire.hashnode.dev/what-is-a-single-page-application</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Beginner Developers]]></category><dc:creator><![CDATA[Franklin Okolie]]></dc:creator><pubDate>Mon, 08 Mar 2021 15:18:33 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1623236246656/-XPjlgKfK.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello there, welcome to my blog. I am always happy to share my knowledge and as well educate other developers out there about some concepts that they have a shallow understanding of. One of such concepts I will be sharing today is explaining what single-page applications really are. The web ecosystem has changed in the last decades and is continuing to change, these changes have led to a lot of improvements on how software developers think and write code to solve problems. Single-page applications pretty much confused me and I couldn't get my head around it or even know how it works, but knowing what it is has changed the way I write code and given me the ability to know what tools to choose when building a web application. So relax and enjoy the read.</p>
<blockquote>
<h3 id="what-you-will-learn-in-this-article">What you will learn in this article:</h3>
<ul>
<li>What are single-page applications</li>
<li>Why use the single-page applications method</li>
<li>Examples of single-page applications</li>
</ul>
</blockquote>
<h1 id="what-are-single-page-applications">What are single-page applications?</h1>
<p>Single-page applications are websites or web applications that request just one blank HTML page from the server and change the content of the page by dynamically injecting new data as the user interacts with the website, instead of the default method of the browser loading entire new pages. The goal is to make a web application faster and make it feel smoother. Now let break this down.</p>
<p>Traditionally, web pages which are HTML pages and all their style and scripting are stored on a remote server and are pushed to the browser whenever a request is made by the user. This method is usually slow as the browser is trying to load all the styling and scripting in one go. </p>
<p>But with single-page applications, all the styling and scripting are stored there on the browser and are dynamically injected into the website. The website only uses one blank page that is requested when the website loads, the browser makes several requests after this not to get webpages but for data to dynamically populate the webpage.</p>
<h1 id="why-use-the-single-page-applications-method">Why use the single-page applications method?</h1>
<p>Just as the internet is evolving, the world is also evolving with it, people now spend much time on the internet chatting, ordering things, watching movies, and many other things. Nobody wants to spend minutes waiting for a website to load so they can use it, they will simply get impatient and move to the faster one. Web applications are also getting complicated and heavy and demands a large amount of load time if all the pages were gotten from a server. For example, Google, a single search on Google brings over a thousand results, imagine those thousand pages where stored on a server and get loaded on a single search by a user, of course, Google would be really slow, so Google uses one single-page and dynamically changes the content on this page from the data it gets. Below are some of the reasons to use the single-page applications method when building web applications.</p>
<ul>
<li>Faster web applications</li>
<li>Less load time</li>
<li>Reduced heavy load on the server</li>
<li>Make your web app data-driven not page-driven</li>
<li>Happy and satisfied users</li>
</ul>
<h1 id="examples-of-single-page-applications">Examples of single-page applications</h1>
<p>I am going to list some websites that use the single-page application method and of course, these are the website we enjoy so much, things happen almost instantly, there is no silly load to the server every now and then. </p>
<ul>
<li><a target="_blank" href="https://twitter.com/">Twitter</a></li>
<li><a target="_blank" href="https://facebook.com/">Facebook</a></li>
<li><a target="_blank" href="https://github.com/">Github</a></li>
<li><p><a target="_blank" href="https://google.com/">Google</a></p>
<p>There are many more but these are the most practical ones we interact with every day.</p>
</li>
</ul>
<h1 id="in-conclusion">In conclusion</h1>
<p>Single-page applications are steadily becoming the norm on how developers build web applications and with frameworks like Vue, React, Angular, Ember, Backbone e.t.c which can serve as useful tools for building single-page applications faster and easier.</p>
<p>So we have come to the end of this amazing article. Hope you learned something useful. If you did, like, share, comment, just do anything to make it go viral. </p>
<p>I would be posting more articles, so be sure to follow me to get notified when I post them.</p>
<p>If you have any questions concerning Go, Javascript, TailwindCSS, Open-source, or this article? You can reach me on <a target="_blank" href="https://twitter.com/DeveloperAspire">Twitter</a>. Till next time, see ya. Thank you.</p>
]]></content:encoded></item><item><title><![CDATA[What is an IFFE in JavaScript?]]></title><description><![CDATA[Hello there, welcome to my blog. Software engineers basically solve problems through code and this takes a thorough process from planning, applying…]]></description><link>https://developeraspire.hashnode.dev/what-is-an-iffe-in-javascript</link><guid isPermaLink="true">https://developeraspire.hashnode.dev/what-is-an-iffe-in-javascript</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[software development]]></category><category><![CDATA[Web Development]]></category><dc:creator><![CDATA[Franklin Okolie]]></dc:creator><pubDate>Tue, 02 Mar 2021 15:17:08 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1623236278423/a9sKfS2Qr.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello there, welcome to my blog. Software engineers basically solve problems through code and this takes a thorough process from planning, applying principles and best practices to make the code readable and reusable, software engineers don't just open their code editors and jump in and start writing codes, they plan it out, which would always include using best practices, and one of the best practice is the DRY(Don't Repeat Yourself) principle. In my last article <a target="_blank" href="https://developeraspire.hashnode.dev/a-look-into-variable-scoping-in-programming">here</a>, I explained variable scoping and how they affect your codebase, but today I would be explaining one of the ways we can follow the DRY principles using IFFE. Does that sound strange? If it does, then this article is definitely for you. Grab your popcorn.</p>
<h1 id="what-is-iffe">What is IFFE?</h1>
<p>IFFE means Immediately Invoked Function Expressions. IFFE is widely used in patterns that power most of the JavaScript frameworks in the ecosystem and can be used in vanilla javascript too, at least I use it. IFFE as the names imply is a function that is immediately called after it has been declared. With IFFE, variables and whatever is defined within that function is made private, private meaning that the values of anything within the function block can not be accessed outside it. With IFFE software engineers can scope variables, objects, and even methods to avoid function name conflict and they can also break their code into different modules that perform a specific task without conflict from each module or function. Let take a look at the different type of functions.</p>
<h2 id="function-statement">Function Statement</h2>
<p>This is the most popular way of declaring functions that every beginner in JavaScript has come across, we simply create a function with the keyword <code>function</code> and add a name, then add parenthesis that takes in an optional parameter and curly brackets. Then we can invoke the function by calling its name with a parenthesis.</p>
<pre><code class="lang-JS"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">exampleOne</span>(<span class="hljs-params"></span>)</span>{
 <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"Example 1"</span>)

} 
exampleOne();
<span class="hljs-comment">// Output: "Example"</span>
</code></pre>
<h2 id="function-expression">Function Expression</h2>
<p>These are functions that are nameless and thereby passed into a variable for it to be accessed.
Just like a normal function but has no name.</p>
<pre><code class="lang-JS"><span class="hljs-keyword">const</span> exampleTwo = <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>)</span>{
 <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"Example 2"</span>)

} 
exampleTwo();
<span class="hljs-comment">// Output: "Example 2"</span>
</code></pre>
<h1 id="immediately-invoked-functions-expressionsiffe">Immediately Invoked Functions Expressions(IFFE)</h1>
<p>IFFE is immediately Invoked, it doesn't need a name or variable to invoke it, by simply adding a parenthesis  <code>()</code> at the end of the function immediately invokes it. Also, IFFE is treated like an expression, which means it is wrapped in a () parenthesis. </p>
<pre><code class="lang-JS"> (<span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>)</span>{
 <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"Example 3"</span>)

})();

<span class="hljs-comment">// Output: "Example 2"</span>
</code></pre>
<p>This is a basic example of an IFFE, as you can see I didn't need to call its name, just () at the end.</p>
<p><strong>Note</strong>: Do not miss the semi-colon after the () as it would throw an error.</p>
<p>With IFFE an engineer that has 100 functions wouldn't fear messing up function names since he/she can make them go nameless and still achieve the same result with named functions. With IFFE you can have multiple functions in it with names but there only exist within that function and can't be accessed outside. This would give every engineer a readable and reusable codebase.</p>
<h2 id="accepting-argument-in-iffe">Accepting Argument in IFFE</h2>
<p>IFFE is not limited to only scoping stuff but does the basic thing that every function does which include accepting parameters and arguments.</p>
<pre><code class="lang-JS"> (<span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">num1,num2</span>)</span>{
 <span class="hljs-keyword">var</span> answer = num1 + num2
<span class="hljs-built_in">console</span>.log(answer)

})(<span class="hljs-number">2</span>,<span class="hljs-number">3</span>);

<span class="hljs-comment">// Output: 5</span>
</code></pre>
<p>Now let try to access that <code>answer</code> variable outside the IFFE. </p>
<pre><code>(<span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">num1,num2</span>)</span>{
 <span class="hljs-keyword">var</span> answer = num1 + num2
<span class="hljs-built_in">console</span>.log(answer)

})(<span class="hljs-number">2</span>,<span class="hljs-number">3</span>);
<span class="hljs-built_in">console</span>.log(answer)

<span class="hljs-comment">// Output: 5</span>
<span class="hljs-comment">//  Uncaught ReferenceError: answer is not defined.</span>
</code></pre><p>Now let's take a step further and make two variables with the same name to see if we can get a conflict.</p>
<pre><code><span class="hljs-keyword">var</span> answer = <span class="hljs-number">20</span>;

(<span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">num1,num2</span>)</span>{
 <span class="hljs-keyword">var</span> answer = num1 + num2
<span class="hljs-built_in">console</span>.log(answer)

})(<span class="hljs-number">2</span>,<span class="hljs-number">3</span>);
<span class="hljs-built_in">console</span>.log(answer)

<span class="hljs-comment">// Output: 5</span>
<span class="hljs-comment">//  20</span>
</code></pre><p>From the example, JavaScript didn't count the <code>answer</code> variable inside the IFFE as global scope. On a good day, this has saved us a lot of stress from debugging</p>
<h3 id="advantages-of-iife">Advantages of IIFE:</h3>
<ul>
<li>Do not create unnecessary global variables and functions</li>
<li>Functions and variables defined in IIFE do not conflict with other functions &amp; variables even if they have the same name.</li>
<li>Organize JavaScript code.</li>
<li>Make JavaScript code maintainable.</li>
</ul>
<p>With this knowledge, you can start writing readable, easy-to-maintain code which is part of what makes you an awesome developer.</p>
<blockquote>
<p>Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live - John Woods.</p>
</blockquote>
<p>Who knows it maybe me... Lol.</p>
<h2 id="in-the-end">In the end...</h2>
<p>So we have come to the end of this amazing article. Hope you learned something useful. If you did, like, share, comment, just do anything to make it go viral. </p>
<p>I would be posting more articles, so be sure to follow me to get notified when I post them.</p>
<p>If you have any questions concerning Go, Javascript, TailwindCSS, Open-source, or this article? You can reach me on <a target="_blank" href="https://twitter.com/DeveloperAspire">Twitter</a>. Till next time, see ya. Thank you.</p>
]]></content:encoded></item><item><title><![CDATA[A Look into Variable Scoping in Programming.]]></title><description><![CDATA[Hello there, welcome to my blog. Building enterprise applications is no small feat for any software engineer, the code can span up to millions of lines and…]]></description><link>https://developeraspire.hashnode.dev/a-look-into-variable-scoping-in-programming</link><guid isPermaLink="true">https://developeraspire.hashnode.dev/a-look-into-variable-scoping-in-programming</guid><category><![CDATA[Web Development]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[General Programming]]></category><category><![CDATA[Go Language]]></category><dc:creator><![CDATA[Franklin Okolie]]></dc:creator><pubDate>Fri, 19 Feb 2021 15:48:05 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1623236317084/OQURJu8_K.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello there, welcome to my blog. Building enterprise applications is no small feat for any software engineer, the code can span up to millions of lines and can't be written by a single engineer, many software engineers come together to write this application. While at this, it is important that each engineer on the team should have the ability not just to write code but to write clean, readable, and reusable code. But to be able to write and read clean code, a software engineer should have a strong foundation of programming concepts. One of such concepts are what I am going to be teaching you today called "Scoping". If you are a software engineer willing to grow your coding skills to another level by following the best practices, writing cleaner and reusable code, then this article is for you. I have been following best practices since I became a developer, and I thought I share some of what I have learned so far. Relax and enjoy the read, and do grab a pop-corn</p>
<blockquote>
<p><strong>What you learn from this article</strong></p>
<ul>
<li>What is Scoping?</li>
<li>Scoping in JavaScript</li>
<li>Scoping in Golang</li>
</ul>
</blockquote>
<h2 id="what-is-scoping">What is Scoping?</h2>
<p>A lot of newbie developers and even junior developers still find this concept hard to grasp and they, therefore, skip it and move to the next phase, in turn making them write bad code.</p>
<p>Scoping in programming refers to the position of a variable, which determines the accessibility of variables in the codebase. That is how simple it is. Where you declare your variables and how you access them plays an important role in how you write good code that everyone can read. </p>
<p>There are 2 types of scoping: Global scoping and Block scoping. In this section, I would be explaining scoping in 2 programming languages, Golang and JavaScript.</p>
<h3 id="global-scoping-vs-block-scoping">Global Scoping vs Block Scoping</h3>
<p>Global scoping are those variables declared outside a block which can be a Function, If statement, Object methods, Loops block e.t.c and to this effect can be accessed anywhere within the codebase.</p>
<p>Block scoping are those variables declared inside a block, and such blocks include; Function, If statement, Object methods, Loops blocks e.t.c and therefore can only be accessed within that block which it was declared. Do you get it? Hang on, I have some real-life examples to show you.</p>
<h2 id="scoping-in-javascript">Scoping in JavaScript</h2>
<p>Let use the dog-pet example, while some people buy a pet dog to keep in their home, others choose to buy the pet and let it wander around the neighborhood and comes back when it feels like. 
Mr. James buys his dog and lets it wander while Mr. Franklin buys his dog and keep it in his house only. From the illustration above, we can bring it into programming and say Mr. James has declared a global variable and Mr. Franklin has declared a local variable. Mr. James's dog can be seen and touched by everyone in the hood while Mr. Franklin's dog is meant to be touched and seen by only his family. Now let see that in code.</p>
<pre><code class="lang-JS"><span class="hljs-keyword">let</span> dog1 = <span class="hljs-string">"flames"</span>;

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">dogName</span>(<span class="hljs-params"></span>)</span>{
     <span class="hljs-keyword">let</span> dog2 = <span class="hljs-string">"fire"</span>;
      <span class="hljs-built_in">console</span>.log(dog1)
     <span class="hljs-built_in">console</span>.log(dog2)
}
<span class="hljs-built_in">console</span>.log(dog1)
     <span class="hljs-built_in">console</span>.log(dog2)
</code></pre>
<p>Output: </p>
<pre><code><span class="hljs-comment">// Code in the function</span>
<span class="hljs-string">"flames"</span>
<span class="hljs-string">"fire"</span>

<span class="hljs-comment">// Code outside function</span>
<span class="hljs-string">"flames"</span>
Reference error: dog2 <span class="hljs-keyword">is</span> not defined
</code></pre><p>From the above code, you can see <code>dog1</code> was accessible everywhere in the code including inside the function but <code>dog2</code> which was declared in a function block was not accessible outside the function block which is its birthplace and death place too. When I tried to log out <code>dog2</code>, JavaScript simply told me "Hello, There is nothing like <code>dog2</code> within my view". Does this mean JavaScript is blind or that <code>dog2</code> doesn't exist? Nope. It simply means we set the rules that <code>dog2</code> should only be available in the <code>dogName</code> function.  </p>
<p>Nevertheless, we can get <code>dog2</code> to log by calling the <code>dogName</code> function since it was declared globally. See the example below:</p>
<pre><code class="lang-JS"><span class="hljs-keyword">let</span> dog1 = <span class="hljs-string">"flames"</span>;

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">dogName</span>(<span class="hljs-params"></span>)</span>{
     <span class="hljs-keyword">let</span> dog2 = <span class="hljs-string">"fire"</span>;
      <span class="hljs-built_in">console</span>.log(dog1)
     <span class="hljs-built_in">console</span>.log(dog2)
}
<span class="hljs-built_in">console</span>.log(dog1)
  dogName()
</code></pre>
<p>Output: </p>
<pre><code><span class="hljs-comment">// Code in the function</span>
<span class="hljs-string">"flames"</span>
<span class="hljs-string">"fire"</span>

<span class="hljs-comment">// Code outside function</span>
<span class="hljs-string">"flames"</span>
<span class="hljs-string">"flames"</span>
<span class="hljs-string">"fire"</span>
</code></pre><h2 id="scoping-in-golang">Scoping in Golang</h2>
<p>One of the most elite languages developed by Google and a very useful tool. I picked it up sometime last year and it has been great learning it. Lol...</p>
<p> Just like every other programming language has the same concept just a change of name, Golang has the package level scoping(Global scoping)  and Block scoping. The very same way we did it in Javascript, just a change of name and syntax. Still using Mr. James and Mr. Franklin's illustration, let write some code.</p>
<pre><code class="lang-GO"><span class="hljs-keyword">package</span> main

<span class="hljs-keyword">import</span> (
    <span class="hljs-string">"fmt"</span>
)

<span class="hljs-keyword">var</span> dog1 <span class="hljs-keyword">string</span> = <span class="hljs-string">"mike"</span>

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">main</span><span class="hljs-params">()</span></span> {
<span class="hljs-keyword">var</span> dog2 <span class="hljs-keyword">string</span> = <span class="hljs-string">"miko"</span>
    fmt.Println(dog1)
   fmt.Println(dog2)
}

<span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">printDog</span><span class="hljs-params">()</span></span>{
 fmt.Println(dog1)
   fmt.Println(dog2)

}
</code></pre>
<p>Output :
(spoiler alert: The code won't run)</p>
<pre><code><span class="hljs-attribute">undefined</span>: dog2
</code></pre><p>Go is a statically typed language, unlike JavaScript and other loosely typed languages, Go would never run a code if one line is wrong, but JavaScript let us run it and tell us the error when the job is done, not so with Go, you can try this example on  <a target="_blank" href="https://play.golang.org/">Go playground</a>. But away from that, we know that <code>dog2</code> was declared in the <code>main</code> function, therefore not accessible outside it, and that line broke the code. </p>
<p>If you are really interested in Go, or the spirit of Go has whispered to you "Learn me", you should check <a target="_blank" href="https://developeraspire.hashnode.dev/introduction-to-google-go-beginner-guide">Introduction to Go</a> and <a target="_blank" href="https://developeraspire.hashnode.dev/understanding-variables-and-data-types-in-go">Variables and Data types in Go</a>.</p>
<p>With this piece of knowledge, you can now know how best to create variables and use them properly giving your codebase readability and a clean look, and also avoiding you pulling off your hair when JavaScript tells you "<code>undefined</code>". All you just have to do is check the scope of the variable you are using at the moment, you just solved a bug!!.</p>
<h2 id="in-the-end">In the end...</h2>
<p>So we have come to the end of this amazing article. Hope you learned something useful. If you did, like, share, comment, just do anything to make it go viral. </p>
<p>I would be posting more articles, so be sure to follow me to get notified when I post them.</p>
<p>If you have any questions concerning Go, Javascript, TailwindCSS, Open-source, or this article? You can reach me on <a target="_blank" href="https://twitter.com/DeveloperAspire">Twitter</a>. Till next time, see ya. Thank you.</p>
]]></content:encoded></item><item><title><![CDATA[An API? What exactly is it?]]></title><description><![CDATA[Hello there, welcome to my blog. Jenna and I were hungry one afternoon and decided to hit the restaurant to get some food before we get back to coding. As…]]></description><link>https://developeraspire.hashnode.dev/an-api-what-exactly-is-it</link><guid isPermaLink="true">https://developeraspire.hashnode.dev/an-api-what-exactly-is-it</guid><category><![CDATA[APIs]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Frontend Development]]></category><dc:creator><![CDATA[Franklin Okolie]]></dc:creator><pubDate>Wed, 03 Feb 2021 11:15:04 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1612350896420/YP-Vi35SY.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello there, welcome to my blog. Jenna and I were hungry one afternoon and decided to hit the restaurant to get some food before we get back to coding. As we entered the restaurant, the tables and chairs were set in an organized manner, the waiters all had a smile on their faces which was welcoming, we sat down and beckoned on a sweet looking waitress, she couldn't wait to handle us the order list. I picked so did Jenna too. In a few minutes, the order landed and we got started with the food. Just in the middle of the meal, I stopped and jumped with excitement, Jenna had to pull me down because I was attracting attention. "What?" She asked me. "I now understand fully how an API works on the web". I replied. " And am going to write it for the world to know". I added. Well, Jenna thought I was crazy, she didn't see any Javascript engine around. It was just food only, but she knows for sure, I have been trying hard to understand API enough to teach it, and that day was my lucky day. And here am I trying to write about it now.</p>
<blockquote>
<p>If you can't explain it to a 6-year-old, you don't understand it yourself - <strong>Albert Einstein</strong></p>
</blockquote>
<p>For me, one of the misconceptions I had about APIs was that they were tough to understand and are for gurus alone, not until I started consuming them myself, and realized what it really means and what function it does on the web. You may be confused about API too or have a shallow understanding of it, this article is here to explain it to you using real-life scenarios. In this tutorial, I am going to break down the meaning of API. Do grab a popcorn.</p>
<h2 id="what-is-an-api">What is an API?</h2>
<p>API stands for application programming interface, I remember looking at those words and asking myself "What does that even mean?", but am not here to confuse you but to explain it to you like a 6-year-old.</p>
<h3 id="how-the-web-works">How the web works</h3>
<p>In the internet world, there is always a client and a server, this is mostly a browser or an app as the client and a remote or virtual server as the server. Webpages are stored in these servers and are given to the client upon request. When you type www.google.com in your browser, the request goes out to Google servers and the server returns the Google homepage back to the browser. But wait, what returned it? Remember the server is sitting somewhere, then what is moving from back and forth from the client to the server? Take a guess? Yes! an API!! That is the messenger. The internet is a place where thousands of servers are connected to each other and each of these servers has a messenger that does the walking around the internet world. These messengers are APIs, these APIs are part of the servers but not the server. Let take a look at some scenarios</p>
<h2 id="facebook-scenario">Facebook scenario</h2>
<p>When you open your Facebook app, that is the client and you click on the icon, the API moves fast to the server and requests for the homepage since that is the default page for any website. If you are logged in, your newsfeed gets displayed, if not, a login/registration page is given to you. You may not notice this, because all this happens at the speed of light, if your request is not found on the server, it returns an error(404 pages not found), I am sure most of you have seen such. Your app has interacted with the Facebook API and as long as you keep clicking on posts, comment, liking pictures, the API continues to move back and forth. Facebook login API is made public which has been used by many websites for social media login to save you the stress of typing passwords.</p>
<h2 id="google-scenario">Google scenario</h2>
<p>You want to make a cake but don't know-how, so you pull out your smartphone, open your Google app, and type "How to make a cake". Before you even blink your eyes, this is what happens: Google API which is sometimes called a web crawler, moves to thousands of servers on the internet requesting for every webpage with the words "How", "to", "make", "a", "cake", and returns all those requests which of course would be in millions if you care to count them. Now you choose the best tutorial and smile as you make your cake. Do keep some for me though. If your request is not found on any server the server tells the API "Yo, man I don't know what you are talking about" and the API returns a 404 error. From this illustration, you can see that an API is nothing to be scared of, just an internet messenger boy.</p>
<h2 id="barman-scenario">Barman scenario</h2>
<p>While you are tired of trying to fix that React bug, you decide to hit the bar and get a pint of beer right? On getting there, you tell the barman "I want a pint of stout", the barman moves to the bar and returns with it, and there you go gulping all the beer. The bar is the server, the beer is the webpage or data, and the barman is an API, and you dear reader is the user of the app. You see how simple it is right? Let take it a bit further, then you decide to try out another beer, "Hey can I have a pint of porter?". The barman moves again but this time returns with a frown, "We currently don't have that now". That is a 404 error. </p>
<h2 id="the-restaurant-scenario">The restaurant scenario</h2>
<p>This is me, after I screamed in this restaurant, embarrassing myself and my dear friend, I knew I had to write this. The restaurant is a website or app, the chairs, tables, and decorations, are the Frontend of the website which frontend developers build with HTML, CSS, and Javascript. The waiters are the APIs standing around waiting for your request, so they can process it at the speed of light. Then we have the chefs which are the backend developers who are in charge of the servers which is the kitchen where the foods are served from and the foods are data/webpages these APIs get upon request from users. That is the whole point of the internet, everything is well organized and ready for the users. So I requested Fried rice, chicken, a pack of juice to go down with, zoom the waiters(API) when to the kitchen(server) managed by the chefs, and got the food back to me which I consumed with my whole heart. Now that how an API works and that is exactly what it is.</p>
<h3 id="other-apis-you-dont-know">Other APIs you don't know</h3>
<p>Do you know your CSS classes are APIs? Bet you don't know, well they are some kind of API called a browser API, when you add a class name to your CSS, your browser makes a request to the class and the CSS class goes to the CSS stylesheet where the styles of the class have been declared and render the results to your browser. That is it. Some other APIs include:</p>
<ul>
<li>FetchAPI in Javascript</li>
<li>StorageAPI in Javascript</li>
<li>Queryselectors for getting element of the DOM</li>
<li>GeolocationAPI  and many more others</li>
</ul>
<blockquote>
<p>See an API as a humble errand boy, and that is what it is.</p>
</blockquote>
<h2 id="in-the-end">In the end...</h2>
<p>You have reached the end of this amazing article. I finished my popcorn, what about you?. Now you have seen the true meaning of an API, I wished there was someone who explained it like this to me, I wouldn't have spent so much time running away from it, because I had the misconception that it was hard.</p>
<p>Hope you learned something useful? If you did, like, share, comment, just do anything to make it go viral. </p>
<p>I would be posting more articles, so be sure to follow me to get notified when I post them. In my next article, I will explain the FetchAPI in Javascript and how to use it, so follow me so you don't miss out.</p>
<p>If you have any questions concerning Go, Javascript, TailwindCSS, Open-source, or this article? You can reach me on <a target="_blank" href="https://twitter.com/DeveloperAspire">Twitter</a>. Till next time, see ya. Thank you.</p>
]]></content:encoded></item><item><title><![CDATA[Open-source project for beginners.]]></title><description><![CDATA[Hello there, welcome to my blog. Olayinka my friend stumbled on my introductory guide to open-source article here and after reading and contributing to the…]]></description><link>https://developeraspire.hashnode.dev/open-source-project-for-beginners</link><guid isPermaLink="true">https://developeraspire.hashnode.dev/open-source-project-for-beginners</guid><category><![CDATA[Open Source]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[learning]]></category><dc:creator><![CDATA[Franklin Okolie]]></dc:creator><pubDate>Tue, 26 Jan 2021 12:46:35 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1611665184054/cZEXogMQz.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello there, welcome to my blog. Olayinka my friend stumbled on my introductory guide to open-source article <a target="_blank" href="https://developeraspire.hashnode.dev/an-immersive-introductory-guide-to-open-source">here</a> and after reading and contributing to the project I listed in the article, he wanted more. Well, too bad for him, as a Javascript developer, he opened Javascript's repo on Github to contribute. It ended in tears. Lol. He came back to me and I had to guide him to many beginner-friendly projects that will make him learn a lot of things in the process.</p>
<p>Many beginners in the open-source space are so misinformed about how to go about contributions, where to contribute, and how to do it. The essence of contributing to a repo should for the primary reason of learning. Yes. By contributing to open-source you learn:</p>
<ul>
<li>Github Actions</li>
<li>Best practices.</li>
<li>How to understand large codebases.</li>
<li>How to interact with other people. and many more</li>
</ul>
<p>The above are also needed in jobs, therefore jumping into a large codebase is not a good approach to learning this, just like my friend, you need to start small. In this article, I will be introducing you to some open-source projects that you can get started with as a beginner in open-source. Do grab a popcorn.</p>
<blockquote>
<p>If you are new to open-source, I will advise you to take this gift wrapped <a target="_blank" href="https://developeraspire.hashnode.dev/an-immersive-introductory-guide-to-open-source">here</a>, so you can be well informed about open-source</p>
</blockquote>
<h2 id="sbuttons">SButtons</h2>
<p>This is really an amazing project for beginners in open-source to contribute to. Here you get to put your CSS skills to practice by contributing to making buttons used on web pages. Wouldn't that be great? Waking up one morning and seeing that a button you styled with CSS is been used by a company because the developers used this library in which your code is included. So go make beautiful buttons, maybe you have a particular button style you love so much. Here is your chance to show it to the world and it is totally beginner-friendly.</p>
<p>Github Repoitory: <a target="_blank" href="https://github.com/sButtons/sbuttons">Sbuttons</a></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1611660562046/ub7XiBDum.png" alt="sbuttons.png" /></p>
<h2 id="freecodecamp-how-to-contribute-to-open-source">Freecodecamp - How to contribute to open-source</h2>
<p>Another amazing one, this repository is really loaded with resources to get you started in open-source and be a pro at it, so you can as well learn from it as well as give back to it. If you stumbled on an amazing open-source project or article, you can simply contribute that piece of information to this repository to add value and keep the repository shining with massive resource for anyone in the nearest future, because new developers are born every day and we as the old ones should prepare some roadmap for them. One reason I am writing this article, so someone else doesn't go jumping head-first in React repo and get hit with confusion. You don't need knowledge of code to get started as no code is needed, just your contribution in written form.</p>
<p>Github Repository: <a target="_blank" href="https://github.com/freeCodeCamp/how-to-contribute-to-open-source">How to contribute to open-source</a></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1611661202768/JEn3nS7KG.png" alt="freecodecamp.png" /></p>
<h2 id="awesome-github-profiles">Awesome Github Profiles</h2>
<p>Github recently introduced a "GitHub profile" where you can create an introduction of yourself in your Github account, so anyone viewing your profile can see some facts about you, and this includes potential employers and clients. It is more like having a Resume on your Github. Have seen some beautiful ones? This repository contains awesome profiles you can draw inspiration from to make yours or you can add yours too to give others inspiration. The repository is maintained by the Eddie community led by <a target="_blank" href="https://twitter.com/eddiejaoude">Eddie Jaoude</a> a Github star. He is waiting to see your Github profile or the amazing ones you have seen and would love the world to see.</p>
<blockquote>
<p>You don't know how to make a Github profile? Don't freak out, I got you. Read this <a target="_blank" href="https://blog.idrisolubisi.com/how-to-add-a-readme-file-to-your-github-profile">article</a> by <a class="user-mention" href="https://hashnode.com/@olanetsoft">Olubisi Idris Ayinde</a></p>
</blockquote>
<p>Github repository: <a target="_blank" href="https://github.com/EddieJaoudeCommunity/awesome-github-profiles">Awesome Github Profile</a></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1611661936752/30gg2fbBC.png" alt="awesome-profle.png" /> </p>
<h2 id="developers-fact-card">Developers Fact Card</h2>
<p>My love for this project, this project has a beginner-friendly guide to first-timers who are seeking to make open source a lifestyle. Do you have a quote you love so much or an experience you have about your career in software engineering? You can write that for the world to see and also the upcoming generation of software developers so they are informed on what the career is really about. Some developers are contributing very educative fact, you are next. Yes, you. Hop on, and you get to learn as you contribute.</p>
<p>Live URL: <a target="_blank" href="https://devfact.vercel.app/">Developers Fact card</a></p>
<p>Github Repository: <a target="_blank" href="https://github.com/DeveloperAspire/Developers-fact-card"> Developers Fact Repository</a></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1611662354715/xf15Dkjl7.png" alt="Developers-Fact-Card.png" /></p>
<h2 id="awesome-tech-blogs">Awesome Tech Blogs</h2>
<p>One thing about repositories bearing "awesome" is that they really are awesome. This repo contains a list of amazing tech blogs found useful by the contributors and maintainers of this project. You can add an awesome blog too that you know about. Maybe this blog. Lol. So go make that pull request now. The maintainers are waiting for you.</p>
<p>Github Repository:<a target="_blank" href="https://github.com/MarkoDenic/awesome-tech-blogs">Awesome Tech blogs</a></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1611662925581/ufZXsg-4w.png" alt="MarkoDenic-awesome-tech-blogs-A-list-of-Tech-Blogs-.png" /></p>
<h2 id="awesome-htmlcssjs-tips">Awesome HTML/CSS/JS Tips</h2>
<p>I remember when I was trying to make a project feature this week and I had an issue which was 'how to make a mouse cursor an image). It is a game app. So I wanted to make the cursor an animated image. This repository came to my aid, it contains a bunch of HTML/CSS and Js tips you probably don't know about, you can learn from it. You just found a Js trick you think nobody knows? Great! contribute it to this repository, tell the world the HTML and CSS tips you have been using for your productivity, we want to hear it. The maintainers and the community are waiting. Come on! Share with us.</p>
<p>Github Repository: <a target="_blank" href="https://github.com/MarkoDenic/awesome-html-css-js-tips">Awesome HTML/CSS/JS Tips</a></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1611663313124/66O5Z7K8L.png" alt="MarkoDenic-awesome-html-css-js-tips.png" /></p>
<h2 id="awesome-uses">Awesome Uses</h2>
<p>Here we go, another repository containing the "awesome" thing. I think this is the recipe for making a great open-source project, once a repository is named "awesome". Boom! It really gets awesome. Lol.
Well, you know they say "save the best for the last", this is it. I love this project so much as it contains a list of hundreds of software developers around the globe, their profiles, their data, and the tech they use for their day-to-day activity which is by the way AWESOME!. You can add yourself too. Yes, you, imagine a decade from now and a newbie in tech buzz you "I saw you on the web which state you use Nodejs, can you mentor me on it?" You are now a Tech-star. So go on and add yourself there, it would be amazing to do so. Trust me. This project is maintained by a superstar tech guy, one of my favorite, <a target="_blank" href="https://twitter.com/wesbos">Wesbos</a>. So he is waiting for your contribution.</p>
<p>Live URL: <a target="_blank" href="https://uses.tech/">Uses.Tech</a></p>
<p>Github Repository: <a target="_blank" href="https://github.com/wesbos/awesome-uses"> Awesome uses</a></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1611664427819/mXjD5eEBC.png" alt="-uses.png" /></p>
<h2 id="in-the-end">In the end...</h2>
<p>You have reached the end of this amazing article. I finished my popcorn, what about you?. So I encourage you to contribute to these projects as they are totally beginner-friendly, from here you can go on and start making meaningful contributions to repositories like Vue, React, Laravel, and many more. But remember you have to start small and this is small, so that from the project above. You will learn a lot, trust me. If you need help getting started with these projects or you get stuck, please don't hesitate to reach me on <a target="_blank" href="https://twitter.com/DeveloperAspire">Twitter</a>, I will put you through.</p>
<p>Hope you learned something useful?. If you did, like, share, comment, just do anything to make it go viral. </p>
<p>I would be posting more articles, so be sure to follow me to get notified when I post them.</p>
<p>If you have any questions concerning Go, Javascript, TailwindCSS, Open-source, or this article? You can reach me on <a target="_blank" href="https://twitter.com/DeveloperAspire">Twitter</a>. Till next time, see ya. Thank you.</p>
]]></content:encoded></item><item><title><![CDATA[Transitions and Animation in TailwindCSS]]></title><description><![CDATA[Hello there, welcome to my blog. Every app user and even the developers themselves love animation, when a user clicks a button or interact with a website…]]></description><link>https://developeraspire.hashnode.dev/transitions-and-animation-in-tailwindcss</link><guid isPermaLink="true">https://developeraspire.hashnode.dev/transitions-and-animation-in-tailwindcss</guid><category><![CDATA[Tailwind CSS]]></category><category><![CDATA[tailwind]]></category><category><![CDATA[CSS]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[CSS Animation]]></category><dc:creator><![CDATA[Franklin Okolie]]></dc:creator><pubDate>Sat, 23 Jan 2021 14:50:26 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1611393862033/NMZnOT6gh.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello there, welcome to my blog. Every app user and even the developers themselves love animation, when a user clicks a button or interact with a website and there are sprinkles on animation here and there, it gives them this buffer fly-in-my-tummy feel. Animations have also become an integral part of technology in this present age, from cartoons to Japanese anime and also on our website.</p>
<p>With CSS and Javascript, any developer can make cool animations that excite users, but we know the stress that comes with writing animations from setting the timing function to the duration and even trying to make sure the movement of the animation is beautiful. Let take for example, a developer who wants to animate a call-to-action button to bounce infinitely to grab user's attention, you should know the number of lines of CSS you would have to write to achieve that but TailwindCSS provides us some first-hand animation classes that we can just add to our CSS class to get a simple animation working, like spinning, bouncing e.t.c. If you are using TailwindCSS, you really don't have to write any CSS animations with <code>@keyframes</code> for this trivial animation. In this article, we are going to learn how to use the Tailwind transition and animation class without using <code>@keyframes</code>. Grab your popcorn.</p>
<blockquote>
<p>In this article I will explain :</p>
<ul>
<li>How to use TailwindCSS animation class.</li>
<li>How to use TailwindCSS transition class.</li>
<li>Learn how to write customized animation in TailwindCSS.</li>
</ul>
<h3 id="prerequisite">Prerequisite</h3>
<ul>
<li>Basic knowledge of CSS transition.</li>
<li>Basic knowledge of CSS animation</li>
</ul>
</blockquote>
<h2 id="transition">Transition</h2>
<p> Transition is the process or a period of changing from one state or condition to another. Transitions are usually triggered by an action of a user on an element, either by hovering, clicking e.t.c. In this section, you are going to learn how to write transitions for different states using the TailwindCSS transition utility classes.</p>
<p>Transition in CSS as we know is done by setting how an HTML element will move from one state to another. For a button, the state can be when a mouse over it, it should change the background color or become larger. We would learn how to write that now.</p>
<pre><code class="lang-HTML"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>= <span class="hljs-string">"text-center p-10"</span>&gt;</span>

  <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"px-8 py-2 mx-auto text-white bg-blue-700 rounded transition duration-500 ease-in-out hover:bg-green-400 "</span>&gt;</span>
       Hello
<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>

<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
</code></pre>
<p>Output:</p>
<iframe src="https://play.tailwindcss.com/ctisLnuOi8?layout=preview" width="100%" height="300" style="border:1px solid black"></iframe>

<p>I just made a <code>div</code> to act as a container and gave it padding of 10 on all sides, and then centered anything inside it. For the <code>button</code> which is our focus; padding on the x-axis(left and right) of 8 which is equal to <code>2rem</code> and padding on the y-axis(top and bottom) of 4 which is equal to <code>1rem</code> and I centered it by giving it an auto-margin on the x-axis(left and right), a white text and a background of blue with a density of 700 and made it rounded(border-radius). Now to the transistion part, I wrote the transition class which would activate transition on the button just like how we would do it in normal CSS, and I gave it a duration of 500miliseconds and a timing-function of ease-in-out, and lastly, I added the state it should transit to which will be triggered by a mouse hover. You can see from the result that it worked. You can use the Tailwind playground to play around with this. Now let go further and add some <code>transform</code> property. Now I want the button to move up a bit when the user hovers over it while also changing the background color.</p>
<pre><code class="lang-HTML"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>= <span class="hljs-string">"text-center p-10"</span>&gt;</span>

  <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"px-8 py-2 mx-auto text-white bg-blue-700 rounded transition duration-500 ease-in-out hover:bg-green-400 transform hover:-translate-y-1"</span>&gt;</span>Hello<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>

<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
</code></pre>
<p>Output: </p>
<iframe src="https://play.tailwindcss.com/yJA5q70289?layout=preview" width="100%" height="300" style="border:1px solid black"></iframe>

<p>Now we can see that the button now moves up a little bit when we hover on the button, so what did I do, I added a <code>transform</code> class which will tell HTML that we want to add some transform property to the element( button), then I added a transform property which is <code>translate</code> so it moves up in the y-axis <code>-translate-y-1</code> which is equal to -0.25rem. That's it, we just added a transition to our button.</p>
<h2 id="animation">Animation</h2>
<p>Animations are making elements move from one position to another over a period of time. Animations can be triggered by an event mostly by scroll but most of the time they are moved by default as the website loads. In this section, we are going to learn how we can use the TailwindCSS default animation utility class as well as create our own animations.</p>
<blockquote>
<p>TailwindCSS provides us with :</p>
<ul>
<li>animate-spin.</li>
<li>animate-bounce.</li>
<li>animate-ping.</li>
<li>animate-pulse.</li>
</ul>
</blockquote>
<p>We can use the above to make animations and as their names imply; spin, bounce, ping, and pulse. We are going to see how I will use the bounce animation on our button from the previous example.</p>
<pre><code class="lang-HTML"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>= <span class="hljs-string">"text-center p-10"</span>&gt;</span>

  <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"px-8 py-2 mx-auto text-white bg-blue-700 rounded transition duration-500 ease-in-out hover:bg-green-400 transform hover:-translate-y-1 animate-bounce"</span>&gt;</span>
     Hello
<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>

<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
</code></pre>
<p>Output:</p>
<iframe src="https://play.tailwindcss.com/nMYaSQ6gdc?layout=preview" width="100%" height="300" style="border:1px solid black"></iframe>

<p>See that TailwindCSS just saved us from having to write a <code>@keyframe</code> to make that small animation. But you can also write your own animation since TailwindCSS doesn't provide all the kinds of heavy animations we may need to use, and we can also customize the default animation too. Let see how we can make that. We would make a spinning circle using TailwindCSS animation class <code>animate-spin</code> then we are going to slow it down by customizing it. This would be fun.</p>
<pre><code class="lang-HTML"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>= <span class="hljs-string">"text-center p-10"</span>&gt;</span>

  <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"px-8 py-2 mx-auto w-32 h-32 text-white bg-blue-700 rounded-full animate-spin"</span>&gt;</span>Hello<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>



<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
</code></pre>
<p>Output:</p>
<iframe src="https://play.tailwindcss.com/rCiy68FT02?layout=preview" width="100%" height="300" style="border:1px solid black"></iframe>

<p>From the above, I made a circle by making a <code>div</code> rounded by giving it a height of <code>h-32</code> and width of <code>w-32</code> which is equal to 8rem of width and height, then <code>rounded-full</code> (border-radius:50%) which made it circular, then padding on the x-axis(left and right) of 8 which is equal to 2rem, the padding on the y-axis (top and bottom) of 2 which Is equal to 1rem and text of white. The text <code>hello</code>, I put it there to help us know that the circle is actually spinning. So now we are going to slow it down a little bit.</p>
<p>Open your <code>tailwind.config.js</code> file and add the following which I will explain below.</p>
<pre><code class="lang-Javascript"><span class="hljs-built_in">module</span>.exports = {
  <span class="hljs-attr">purge</span>: [],
  <span class="hljs-attr">darkMode</span>: <span class="hljs-literal">false</span>, <span class="hljs-comment">// or 'media' or 'class'</span>
  <span class="hljs-attr">theme</span>: {
    },
    <span class="hljs-attr">extend</span>: {
          <span class="hljs-attr">animation</span>:{
       <span class="hljs-string">'spin'</span>: <span class="hljs-string">'spin 3s linear infinite'</span>},
  },
  <span class="hljs-attr">variants</span>: {
    <span class="hljs-attr">extend</span>: {},
  },
  <span class="hljs-attr">plugins</span>: [],
}
</code></pre>
<p>Output:</p>
<iframe src="https://play.tailwindcss.com/KEuP8aORZX?layout=preview&amp;file=config" width="100%" height="300" style="border:1px solid black"></iframe>

<p>From the output, you can see we have slowed it down from the normal speed. So what did I do there, I went to the <code>extend</code> object since  I don't want to over-ride all the default animations, read more about customization in TailwindCSS <a target="_blank" href="https://developeraspire.hashnode.dev/a-gentle-guide-to-customization-in-tailwindcss">here</a> and <a target="_blank" href="https://developeraspire.hashnode.dev/a-gentle-guide-to-customization-in-tailwindcssii">here</a>. Then I targeted animations since that is what I want to customize. Then I added the name I want to call the animation, note you can call it whatever you want, just make sure it matches the class name, for example instead of writing <code>spin</code> I can write <code>spin-slow</code> but will have to change the class name on the HTML element to <code>animate-spin-slow</code> for it to work. Understand? Good, let continue.</p>
<p>The other side is simply the name of the animation whether custom or default, and I used the default animation-name, I just have to call it and specify the duration, timing-function e.t.c as we see above. And that's it. I just slowed it down. Easy peasy. You can go ahead and playground with it to get familiar with it, and it also feels like normal CSS so it is simple to grasp.</p>
<h3 id="making-custom-animations">Making custom animations.</h3>
<p>To add new animation <code>@keyframes</code>, use the keyframes section of your theme configuration in the <code>extend</code> object, since we don't want to overwrite the default animations but rather make ours extend/ be a part of it: Open your <code>tailwind.config.js</code> file and let make an animation.</p>
<pre><code class="lang-Javascript">
<span class="hljs-built_in">module</span>.exports = {
  <span class="hljs-attr">theme</span>: {
    <span class="hljs-attr">extend</span>: {
      <span class="hljs-attr">keyframes</span>: {
         <span class="hljs-attr">wiggle</span>: {
           <span class="hljs-string">'0% :{ transform: '</span>rotate(<span class="hljs-number">-5</span>deg)<span class="hljs-string">' }, 
           '</span><span class="hljs-number">50</span>%<span class="hljs-string">': { transform: '</span>rotate(<span class="hljs-number">5</span>deg)<span class="hljs-string">' },
            100%'</span>: { <span class="hljs-attr">transform</span>: <span class="hljs-string">'rotate(-5deg)'</span> },

         },
      },
       <span class="hljs-attr">animation</span>:{
       <span class="hljs-string">'spin'</span>: <span class="hljs-string">'spin 3s linear infinite'</span>,
       <span class="hljs-string">'wiggle'</span>: <span class="hljs-string">'wiggle 2s linear infinite'</span>},
    },
  },
  <span class="hljs-attr">variants</span>: {},
  <span class="hljs-attr">plugins</span>: [],
}
</code></pre>
<p>Now remember to run <code>npm run build</code> to build it to our CSS</p>
<blockquote>
<p> If you don't know anything about the <code>build</code> please read the installation guide in this <a target="_blank" href="https://developeraspire.hashnode.dev/getting-started-with-tailwindcss-an-overview-and-walkthrough-tutorial">article</a></p>
</blockquote>
<p>And we can change our class to our own animation we made:</p>
<pre><code class="lang-HTML">
<span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>= <span class="hljs-string">"text-center p-10"</span>&gt;</span>

  <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"px-8 py-2 mx-auto w-32 h-32 text-white bg-blue-700 rounded-full animate-wiggle"</span>&gt;</span>Hello<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
</code></pre>
<p>Output:</p>
<iframe src="https://play.tailwindcss.com/kHkslrNYCJ?layout=preview&amp;file=config" width="100%" height="300" style="border:1px solid black"></iframe>


<p>And Yaaay!! our circle is wiggling, more like telling us 'No'. Lol. Anyways, that looks like normal CSS <code>@keyframes</code> just that we are doing it in a Javascript way. We started the Keyframes by declaring a <code>keyframe</code> object which would hold as many animation settings as we want, then I created an animation named <code>wiggle</code> and we set how the animation should behave in a different time in its movement. Easy peasy. And we went down to the <code>animations</code> object and added our own custom animation and I set the duration, timing-function e.t.c. Simple and short.</p>
<h2 id="in-the-end">In the end..</h2>
<p>You have just learned how to use TailwindCSS default animation utility class and also how to customize it and then you have learned how to include your own custom animation. One of the reasons, I love TailwindCSS is because it gives us developer the freedom to do what we want with it. TailwindCSS is a hundred percent customizable giving developers control over their own CSS, which is amazing. So you have come to the end of this amazing article. Hope you learned something useful?. If you did, like, share, comment, just do anything to make it go viral. </p>
<p>I would be posting more articles, so be sure to follow me to get notified when I post them.</p>
<p>If you have any questions concerning Go, Javascript, TailwindCSS, Open-source, or this article? You can reach me on <a target="_blank" href="https://twitter.com/DeveloperAspire">Twitter</a>. Till next time, see ya. Thank you.</p>
]]></content:encoded></item><item><title><![CDATA[A gentle guide to customization in TailwindCSS(II)]]></title><description><![CDATA[Be aware that any value you customize in Tailwind is what you will use throughout your project; you can't use the default value again. Example: Like the…]]></description><link>https://developeraspire.hashnode.dev/a-gentle-guide-to-customization-in-tailwindcssii</link><guid isPermaLink="true">https://developeraspire.hashnode.dev/a-gentle-guide-to-customization-in-tailwindcssii</guid><category><![CDATA[Beginner Developers]]></category><category><![CDATA[Tailwind CSS]]></category><category><![CDATA[tailwind]]></category><category><![CDATA[Web Development]]></category><dc:creator><![CDATA[Franklin Okolie]]></dc:creator><pubDate>Wed, 20 Jan 2021 09:26:24 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1611089898603/kH84ufgWr.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<p>Be aware that any value you customize in Tailwind is what you will use throughout your project; you can't use the default value again. Example: Like the above where we customize colors, we can't use any inbuilt colors from Tailwind again; the same goes for anything other value we customize. Maybe that Tailwind punishment for abandoning her colors she took time to create for you. Lol... Anyways, make sure you specify every color you need to use well because even the default white won't work, or maybe you should look through Tailwind colors very well to be sure your preferred color is not there—a trail off from the first part <a target="_blank" href="https://developeraspire.hashnode.dev/a-gentle-guide-to-customization-in-tailwindcss">here</a>.</p>
</blockquote>
<p>Hello there, welcome back to my blog. The above is a trail off from the first article on customization in TailwindCSS. If you are getting to know that TailwindCSS can be customized, please do well to read the first part <a target="_blank" href="https://developeraspire.hashnode.dev/a-gentle-guide-to-customization-in-tailwindcss">here</a>.</p>
<p>In the first article on customization in TailwindCSS, I explained deeply how we could overwrite TailwindCSS default styles such as colors, font-family, e.t.c, as it pleases us. The article ended with the warning that TailwindCSS default styles won't work again once we customize them. Well, that is one way. Do you know we can still add our on customization and still use TailwindCSS default styles?. That is what we are going to learn in the article.</p>
<blockquote>
<p>The first article was about overwriting the default styles while customizing our own styles; this article is about still using TailwindCSS default styles even after customizing.</p>
</blockquote>
<p>In this article I will explain how to:</p>
<ul>
<li>Customize colors in TailwindCSS</li>
<li>Customize font-family in TailwindCSS  without overriding the default styles for this</li>
</ul>
<h2 id="extending-the-defaults">Extending the defaults</h2>
<p>Starting from where we stopped in the last series of TailwindCSS, where I explained how we could install a Tailwind config file that handles customization in TailwindCSS if you don't know anything about that, read the previous article <a target="_blank" href="https://developeraspire.hashnode.dev/a-gentle-guide-to-customization-in-tailwindcss">here</a>.</p>
<p>As described in the theme documentation, if you'd like to extend the default styles rather than override them, you can do so using the theme. extend object of your <code>tailwind.config.js</code> file, and we would use color as an example here</p>
<pre><code class="lang-Javascript"><span class="hljs-built_in">module</span>.exports = {
  <span class="hljs-attr">theme</span>: {
    <span class="hljs-attr">extend</span>: {
      <span class="hljs-attr">colors</span>: {
        <span class="hljs-string">'regal-blue'</span>: <span class="hljs-string">'#243c5a'</span>,
      }
    }
  }
}
</code></pre>
<p>In the previous article, we overrode styles by writing them directly into the theme <code>{ }</code> object`. Example below:</p>
<pre><code class="lang-Javascript"><span class="hljs-built_in">module</span>.exports = {
  <span class="hljs-attr">theme</span>: {
<span class="hljs-attr">colors</span>: {
        <span class="hljs-string">'regal-blue'</span>: <span class="hljs-string">'#243c5a'</span>,
      }
    <span class="hljs-attr">extend</span>: {     }
    }
  }
}
</code></pre>
<p>But by writing the customization in the<code>extend</code>object, we ask Tailwind to make those customizations of either color, font-family e.t.c an extension of TailwindCSS styles rather than overwriting it.</p>
<p>TailwindCSS, in turn, generates classes like <code>bg-regal-blue</code> in addition to all of Tailwind's default colors. This applies to font-family and any other customization you need to do in TailwindCSS.</p>
<h2 id="customizing-colors">Customizing colors</h2>
<p>In this section, we will customize our own color in TailwindCSS without overriding the default colors.</p>
<p>Open your <code>tailwind.config.js</code> file; if you don't have that, you can run <code>npx tailwindcss init</code> to create one. Now add the following in the <code>extend</code> object.</p>
<pre><code class="lang-Javascript"><span class="hljs-built_in">module</span>.exports = {
  <span class="hljs-attr">theme</span>: {
    <span class="hljs-attr">extend</span>: {
    <span class="hljs-attr">colors</span>:{
       <span class="hljs-string">'indigo-lighter'</span>: <span class="hljs-string">'#b3bcf5'</span>,
      <span class="hljs-string">'indigo'</span>: <span class="hljs-string">'#5c6ac4'</span>,
      <span class="hljs-string">'indigo-dark'</span>: <span class="hljs-string">'#202e78'</span>,
  },
  <span class="hljs-attr">variants</span>: {},
  <span class="hljs-attr">plugins</span>: [],
}
</code></pre>
<p>Then run the <code>build</code> to get the colors added to our style sheet:</p>
<p><code>npm run build:css</code></p>
<p>Now the colors we just added would be available to us together with TailwindCSS default colors. But adding colors in the <code>theme</code> object would overwrite the default colors. Kindly take note of that. So it is in your best judgment to choose which kind of customization you want. TailwindCSS is indeed a darling, giving us so many options to choose from.</p>
<h3 id="customizing-font-family">Customizing Font-family</h3>
<p>You may need to make use of your own fonts without necessarily overwriting the TailwindCSS default font family, and that's what we would learn in the section. Let see how we can do that. I'll make use of Google fonts that provide millions of fonts for free. Head over to <a target="_blank" href="https://fonts.google.com/">Google fonts</a>, type the fonts you want( I will be using Roboto), click on it, select the style you want( I will be picking  regular 400 and medium 500  and copy the link for your HTML page and paste it in your HTML page:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1610207161874/3w3yyt_V0.png" alt="Screenshot_2021-01-09 Google Fonts.png" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1610207302876/mG0eHeO-8.png" alt="Screenshot_2021-01-09 js-ykuoxv - StackBlitz(1).png" /></p>
<p>Now we open our <code>tailwind.config.js</code> and configure it in the <code>extend</code> object.</p>
<pre><code><span class="hljs-string">module.exports</span> <span class="hljs-string">=</span> {
  <span class="hljs-attr">theme:</span> {
    },
    <span class="hljs-attr">extend:</span> {
<span class="hljs-string">fontFamily:</span>{
      <span class="hljs-attr">"rob":</span> [<span class="hljs-string">'Roboto'</span>, <span class="hljs-string">'sans-serif'</span>]},
  },
  <span class="hljs-attr">variants:</span> {
    <span class="hljs-attr">extend:</span> {},
  },
  <span class="hljs-attr">plugins:</span> [],
}
</code></pre><p>Remember the <code>build</code>? We run it again to add this to our stylesheet.</p>
<p><code>npm build:css</code></p>
<blockquote>
<p>Protip: Make your all customization at once, so you can run the <code>build</code> once and for all</p>
</blockquote>
<p>Hooray! Roboto has been activated and of course together with all the default font families that TailwindCSS provides. We can now add the colors and font-family to our HTML by specifying it like this.</p>
<pre><code class="lang-HTML"><span class="hljs-tag">&lt;<span class="hljs-name">h1</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"indigo-lighter font-rob"</span>&gt;</span> Hello there <span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>

<span class="hljs-tag">&lt;<span class="hljs-name">p</span> <span class="hljs-attr">class</span>= <span class="hljs-string">"indigo"</span> <span class="hljs-attr">font-rob</span>"&gt;</span> My name is Franklin <span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
</code></pre>
<p>Isn't that sweet? With the way, TailwindCSS gives us different ways to customize what goes on in our CSS. Am blushing for this framework. There is no limitation to what you can do with it.</p>
<p>I have something to show you. I made a clone of the homepage of an open-source community I have been actively involved with, using TailwindCSS built for scratch and of course customizing my own colors:</p>
<ul>
<li>Original site = <a target="_blank" href="https://eddiejaoudecommunity.github.io/">Eddie community</a></li>
<li>Cloned version = <a target="_blank" href="https://eddiehub-clone.vercel.app/">Eddie-clone</a></li>
</ul>
<p>Tell me what you think in the comment section below. See if you can spot the difference. TailwindCSS is a beast.</p>
<h2 id="conclusion">Conclusion</h2>
<p>So we have come to the end of this amazing article. Hope you learned something useful? If you did, like, share, comment, just do anything to make it go viral. </p>
<p>I would be posting more articles, so be sure to follow me to get notified when I post them.</p>
<p>If you have any questions concerning Go, Javascript, TailwindCSS, Open-source, or this article? You can reach me on <a target="_blank" href="https://twitter.com/DeveloperAspire">Twitter</a>. Till next time, see ya. Thank you.</p>
]]></content:encoded></item><item><title><![CDATA[Responsive design with TailwindCSS]]></title><description><![CDATA[Hello there, welcome to my blog. As a developer writing frontend codes to bring designs to life and in turn making amazing websites and applications that…]]></description><link>https://developeraspire.hashnode.dev/responsive-design-with-tailwindcss</link><guid isPermaLink="true">https://developeraspire.hashnode.dev/responsive-design-with-tailwindcss</guid><category><![CDATA[Tailwind CSS]]></category><category><![CDATA[tailwind]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[CSS]]></category><category><![CDATA[CSS3]]></category><dc:creator><![CDATA[Franklin Okolie]]></dc:creator><pubDate>Mon, 18 Jan 2021 12:43:25 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1610960989008/z7FjKWn9i.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello there, welcome to my blog. As a developer writing frontend codes to bring designs to life and in turn making amazing websites and applications that user enjoys, I have always hit a roadblock every time that makes me grumble all the time. Can you take a guess? Responsive design!!. As front-end developers, we are burdened with the responsibility of making a website as responsive as it can be so it is not only limited to a few users.</p>
<p>The truth be told I always grumble when writing media queries, a CSS function for making a responsive site, I don't know about you but for me, there is always a screen that my website would look bad in, which makes me spend hours upon hours trying to fix it. All this happened until I met TailwindCSS, the love of my life. Many TailwindCSS developers have testified the ease of writing a frontend application that is responsive to <strong>every screen</strong> without ever leaving your HTML file or even writing any Media queries, I am one of them. </p>
<p>In this article, you are going to learn how to use TailwindCSS utility classes to make a responsive frontend application without writing media queries. Are you ready? Grab popcorn.</p>
<blockquote>
<p>If this is your first time hearing about TailwindCSS, do well to read this <a target="_blank" href="https://developeraspire.hashnode.dev/getting-started-with-tailwindcss-an-overview-and-walkthrough-tutorial">article</a> first.</p>
</blockquote>
<h2 id="what-is-responsive-design">What is responsive design?</h2>
<p>Responsive Web design is the approach that suggests that the design and development of an application should respond to the user’s behavior and environment based on screen size, platform, and orientation.</p>
<p>Almost every company these days wants a mobile version of their website. It’s practically important after all: one design for the BlackBerry, another for the iPhone, the iPad, netbook, Kindle — and all screen resolutions must be compatible, too. In the next five years, we’ll likely need to design for a number of additional inventions. When will the madness stop? It won’t, of course. Software engineers just have to adapt to this but that doesn't mean we are not going to create tools that can help us adapt to the speed of the world, and one of those tools is TailwindCSS.</p>
<h2 id="responsive-design-with-tailwindcss">Responsive design with TailwindCSS.</h2>
<blockquote>
<p>According to the Tailwind documentation.....</p>
</blockquote>
<p>Every utility class in Tailwind can be applied conditionally at different breakpoints, which makes it a piece of cake to build complex responsive interfaces without ever leaving your HTML.</p>
<p>There are five breakpoints by default, inspired by common device resolutions:</p>
<ul>
<li><code>sm</code> --  640px minimum-width.</li>
<li><code>md</code> -- 768px minimum-width.</li>
<li><code>lg</code> --   1024px minimum-width.</li>
<li><code>xl</code> --   1280px minimum-width.</li>
<li><code>2xl</code>--  1536px minimum-width.</li>
</ul>
<p>To add a utility class for styling your app but only have it take effect at a certain breakpoint, all you need to do is prefix the utility with the breakpoint name, followed by the : character:</p>
<pre><code class="lang-HTML"><span class="hljs-tag">&lt;<span class="hljs-name">img</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"example.png"</span> <span class="hljs-attr">class</span>= <span class="hljs-string">"w-24 md:w-34 lg:w-full"</span> <span class="hljs-attr">alt</span>=<span class="hljs-string">""</span> &gt;</span>
</code></pre>
<p>What the above means is: when the screen hits 768px(<code>md</code>) the image should resize to <code>w-34</code> and when it hits 1024px(<code>lg</code>) the image should be 100% in width which is <code>w-full</code>. That the magic of TailwindCSS, this has saved us from writing:</p>
<pre><code class="lang-CSS"><span class="hljs-keyword">@media</span> (<span class="hljs-attribute">min-width:</span> <span class="hljs-number">768px</span>) { .....}
<span class="hljs-keyword">@media</span> (<span class="hljs-attribute">min-width:</span> <span class="hljs-number">1024px</span>) { ... }
</code></pre>
<p>Can you see how sweet TailwindCSS is?. Further below this article, we would see a real-life example of this responsive utility class in action.</p>
<h3 id="mobile-first">Mobile First</h3>
<p>90% of users that visit a website or web application uses their mobile phones. I can sit at home and use my phone to order food from uber eats, I don't really need to use a Laptop, while 5% comes from users with tablet devices. This begs the question, "Which screen do I design for first?".</p>
<p>In frontend development, it is now becoming a culture and best practice to do mobile-first development then larger screens such as desktop and laptop comes last. Starting mobile-first design with vanilla CSS is actually tough. But here with TailwindCSS, it is a piece of cake. Trust me.</p>
<p>By default, Tailwind uses a mobile-first breakpoint system, similar to what you might be used to in other frameworks like Bootstrap.</p>
<p>What this means is those unprefixed utilities (like <code>w-24</code>) take effect on all screen sizes, while prefixed utilities (like<code>md: w-34</code>) only take effect at the specified breakpoint and above.</p>
<p>Writing TailwindCSS without specifying the screen breakpoints would apply from the smallest screens to the largest screens. So we can start adding responsiveness by specifying which screen breakpoint should a class have. Below we are going to build a photo gallery containing 4 dogs photos which I would grab from <a target="_blank" href="https://unsplash.com/">Unsplash</a>, and I would make use of the <a target="_blank" href="https://play.tailwindcss.com/">Tailwind playground</a> to write the code. So let dive in, remember we are doing <strong>mobile-first</strong></p>
<pre><code class="lang-HTML"><span class="hljs-tag">&lt;<span class="hljs-name">section</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">img</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"w-4/5 my-2 mx-auto "</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"Dog1.png"</span> <span class="hljs-attr">alt</span>=<span class="hljs-string">""</span>&gt;</span>

<span class="hljs-tag">&lt;<span class="hljs-name">img</span>  <span class="hljs-attr">class</span>=<span class="hljs-string">"w-4/5 my-2 mx-auto  src="</span><span class="hljs-attr">Dog2.png</span>" <span class="hljs-attr">alt</span>=<span class="hljs-string">""</span>&gt;</span>

<span class="hljs-tag">&lt;<span class="hljs-name">img</span>  <span class="hljs-attr">class</span>=<span class="hljs-string">"w-4/5  my-2 mx-auto  "</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"Dog3.png"</span> <span class="hljs-attr">alt</span>=<span class="hljs-string">""</span>&gt;</span>

<span class="hljs-tag">&lt;<span class="hljs-name">img</span>  <span class="hljs-attr">class</span>=<span class="hljs-string">"w-4/5  my-2 mx-auto "</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"Dog4.png"</span> <span class="hljs-attr">alt</span>=<span class="hljs-string">""</span>&gt;</span>


<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>


<span class="hljs-tag">&lt;/<span class="hljs-name">section</span>&gt;</span>
</code></pre>
<blockquote>
<p>Note: Links to images were removed to make the markup readable. Here is the link to the <a target="_blank" href="https://play.tailwindcss.com/LVOEMZwUim">project</a></p>
</blockquote>
<p>Here I created a <code>section</code> that would serve as a <code>body</code> tag for us, then created a <code>div</code> that would serve as a container to hold our dog pictures. The images have a <code>width</code> of 4/5 which is equal to 80%, margin-top and bottom of 2( <code>my-2</code>), and a margin-auto for left and right(<code>mx-auto</code>) to center the pictures on the screen. That all for that. This styles would apply to all screens as long as we don't specify a breakpoint, in this case, I want the dogs' pictures to stack on top of each other on mobile but form a grid on larger screens. </p>
<p>Output on mobile:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1610972238902/5CM6jYtFj.png" alt="dog-pic.png" /></p>
<p>Just as we want it. But to make it grid-like on larger screens like tablets, desktops, or laptops we have to add a breakpoint, and thanks to the TailwindCSS utility class, we don't need to write any media queries.  Here we go:</p>
<pre><code class="lang-HTML"><span class="hljs-tag">&lt;<span class="hljs-name">section</span>&gt;</span>

<span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"md:grid grid-cols-2 gap-2"</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">img</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"w-4/5 my-2 mx-auto md:w-full"</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"Dog1.png"</span> <span class="hljs-attr">alt</span>=<span class="hljs-string">""</span>&gt;</span>

<span class="hljs-tag">&lt;<span class="hljs-name">img</span>  <span class="hljs-attr">class</span>=<span class="hljs-string">"w-4/5 my-2 mx-auto md:w-full"</span>  <span class="hljs-attr">src</span>=<span class="hljs-string">"Dog2.png"</span> <span class="hljs-attr">alt</span>=<span class="hljs-string">""</span>&gt;</span>

<span class="hljs-tag">&lt;<span class="hljs-name">img</span>  <span class="hljs-attr">class</span>=<span class="hljs-string">"w-4/5  my-2 mx-auto  md:w-full"</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"Dog3.png"</span> <span class="hljs-attr">alt</span>=<span class="hljs-string">""</span>&gt;</span>

<span class="hljs-tag">&lt;<span class="hljs-name">img</span>  <span class="hljs-attr">class</span>=<span class="hljs-string">"w-4/5  my-2 mx-auto md:w-full"</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"Dog4.png"</span> <span class="hljs-attr">alt</span>=<span class="hljs-string">""</span>&gt;</span>


<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>

<span class="hljs-tag">&lt;/<span class="hljs-name">section</span>&gt;</span>
</code></pre>
<p>Here we just added some styles that would apply to a specific breakpoint <code>md</code> which is 768px and above. It is just like saying "when the screen hits 768px and above, apply this style". Simple!</p>
<p>From the above, I made the images 100% width when the screen becomes 768px <code>md:w-full</code>, and for the container <code>div</code> wrapping all the pictures, I made it a grid container, using CSS grid which is available in TailwindCSS, when the screen becomes larger, I want a 2-grid formation, making the pictures 2 on a row and giving it a grid-gap of 2. Easy peasy, No media queries. Such a relief.</p>
<p>Output on a laptop:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1610973038364/VSEA4vh-2.png" alt="dog-pic2.png" /></p>
<p>Can you believe what we just did? No CSS!!. TailwindCSS is really amazing.  </p>
<blockquote>
<p>Another project I made with TailwindCSS is <a target="_blank" href="https://devfact.vercel.app/">Developers fact card</a> and an open-source project. Used TailwindCSS 100% from responsiveness to the grid system. Check it out, and make a PR too!.</p>
</blockquote>
<p>With this knowledge in your hands, you can now effectively design your frontend application using TaiwindCSS responsive utilities with the 5 breakpoints without ever worrying about media queries.</p>
<h2 id="in-the-end">In the end...</h2>
<p>So we have come to the end of this amazing article. Hope you learned something useful. If you did, like, share, comment, just do anything to make it go viral. </p>
<p>I would be posting more articles, so be sure to follow me to get notified when I post them.</p>
<p>If you have any questions concerning Go, Javascript, TailwindCSS, Open-source, or this article? You can reach me on <a target="_blank" href="https://twitter.com/DeveloperAspire">Twitter</a>. Till next time, see ya. Thank you.</p>
]]></content:encoded></item><item><title><![CDATA[An immersive introductory guide to Open-source]]></title><description><![CDATA[Hello there, welcome to my blog. Do you know I can close my eyes and list 10 great software and apps that you use every day that are open-sourced and you…]]></description><link>https://developeraspire.hashnode.dev/an-immersive-introductory-guide-to-open-source</link><guid isPermaLink="true">https://developeraspire.hashnode.dev/an-immersive-introductory-guide-to-open-source</guid><category><![CDATA[Open Source]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[opensource]]></category><dc:creator><![CDATA[Franklin Okolie]]></dc:creator><pubDate>Sat, 16 Jan 2021 13:04:15 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1610787544004/5aFtAkiVV.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="introduction">Introduction.</h2>
<p>Hello there, welcome to my blog. Do you know I can close my eyes and list 10  great software and apps that you use every day that are open-sourced and you can add a feature to it if you feel the need to? That quite a long question, Lol. But do you know the source code of <a target="_blank" href="https://www.videolan.org/vlc/index.html">VLC</a> media player is free and available for the public? which means you can actually download the source code, modify it, add new features. Isn't that amazing?. That is the power of Open-source, and in this article, you and I are going to learn what this "open-source" means and how to get started with it. Are you ready? Alright! make sure you grab some popcorn.</p>
<blockquote>
<p>Another great example of Open-source software is <a target="_blank" href="https://www.android.com/">Andriod</a>, the software that runs on mobile phones, if you aren't using an iPhone, you are definitely using android.</p>
</blockquote>
<p>This article is aimed to cover :</p>
<ul>
<li>What is Open-source software(OSS)?</li>
<li>Why Open-source is important?</li>
<li>Why should you contribute to open-source software?</li>
<li>How to contribute to Open-source software?</li>
<li>Making your first contribution. ( This would be fun, trust me)</li>
</ul>
<h3 id="what-is-open-source-softwareoss">What is Open-source software(OSS)?</h3>
<p> Open-source software is a type of software in which the source code is publicly available and gives users the license and right to freely use it, download the source code, modify, distribute it, and also contribute to it. </p>
<p> Open-source is free not because it is free of charge but free that it gives anyone the freedom to do what they want with the software and of course won't face any legal issues. One awesome example is Linux, created by <a target="_blank" href="https://twitter.com/linus__torvalds?lang=en">Linus Torvalds</a> in 1991 is an Open-source kernel operating system for desktop, servers, embedded systems, AI(Artificial Intelligence) e.t.c. Many Fortune 500 companies use this software for their day-to-day activities and have modified, and contributed to this Open-source software. Do you need more examples? </p>
<p>Google is a big-time fan of Open-source software, being the maintainers of Andriod have some other Open-source software they maintain and make it freely available to the public, the softwares can be found <a target="_blank" href="https://opensource.google/projects/list/featured">here</a>. Maybe after this article, you can go back and check them out. Google uses a desktop environment in the company called <a target="_blank" href="https://en.wikipedia.org/wiki/Goobuntu">Goobuntu</a>, which is an operating system built upon Linux.</p>
<h2 id="why-open-source-is-important">Why Open-source is important?</h2>
<p>I really don't think that without Open-source software life would be enjoyable. From VLC for playing music and videos to Andriod that powers your phone and even your Facebook app that runs on Open-source server software called Apache. </p>
<p>The importance of Open-source software(OSS) can not be overemphasized as many companies and lives depend on it. Let us see  some examples here:</p>
<ul>
<li><p>If you are a React developer, how would you feel each time you want to create a react app, you are asked to pay? - I know that 
the React library has upgraded since it was created and thanks to all the JavaScript engineers all over the world who contributed to this software, React is getting better every day.</p>
</li>
<li><p>Aside from the creator of the python programming language <a target="_blank" href="https://twitter.com/gvanrossum">Guido van Rossum</a>, python developers all over the world have contributed to this language which makes the language get better every day. Do you honestly think as sweet as python feels, that only one person was able to make it that powerful? Of course not, that was the effort of thousands of developers out there. The same thing applies to languages and framework such as PHP, JavaScript, Laravel, Go, TailwindCSS e.t.c</p>
</li>
</ul>
<p>When software is open-sourced, it invites collaboration from different expert around the world which results in :</p>
<ul>
<li>Finding bugs and resolving them.</li>
<li>Collaboration as people bring their ideas to make the software better.</li>
<li>More features.</li>
<li>Love and unity among developers who contribute to this software. and many more.</li>
</ul>
<p>So you can see why OSS is important. Go and check all the software that is open sourced and see how amazing they are, but note that it is not the effort of a single person but thousands of people coming together.</p>
<blockquote>
<p>Two heads are better than one.</p>
</blockquote>
<h2 id="why-should-you-contribute-to-open-source-software">Why should you contribute to open-source software?</h2>
<p>Yes, why should you? Can you take a minute and close your eyes, now imagine that your favorite app and imagine you can add that feature you think that app needs. Now that one of the many reasons you should contribute to open-source. Aside from that let's look at some of the reasons:</p>
<ul>
<li><p><strong>Collaboration</strong> - By contributing to an OSS you get to meet different people around the world, learn from them, and also learn how to collaborate even though you are miles away from them. Through OSS many have made life partnerships, friendships that lasted for decades and some even met their spouse.</p>
</li>
<li><p><strong>Improvement</strong> - Be you a developer, designer, or writer contributing to OSS, you are sure to improve your skills as you learn new ways of writing code, designing, and also writing. Take for example you are contributing to Andriod as a developer, the codes there are standard and top-notch and before your contribution can be accepted it must follow that style of quality. See you get to learn as you contribute.</p>
</li>
<li><p><strong>Job opportunities</strong> - Yes, as a contributor you can get remote jobs as people from all over the world are seeing your code, contribution, and effort. I know of Henry Yu, who got to work for Babel after he has contributed to the software many times others include <a target="_blank" href="https://twitter.com/Samson_Goddy">Samson Goody</a>, <a target="_blank" href="https://twitter.com/unicodeveloper">Prosper Otemuyiwa</a> and many others. That may be your own case too.</p>
</li>
</ul>
<blockquote>
<p>Open-source is the new sauce.</p>
</blockquote>
<h2 id="how-to-contribute-to-open-source-software">How to contribute to Open-source software?</h2>
<p>So I guess you are ready now and you must be asking "Okay, how". We are going to discuss that now.</p>
<p>One of the misconception beginners in Open-source are fed with, is that contributions to an Open-source software must be code and code alone, but am here to tell you that is not true. Even as a writer you can contribute, here are the various ways you can contribute:</p>
<ul>
<li><p><strong>Documentation</strong>- This includes writing guides, translations, tutorials e.t.c for the OSS on how it is used, installed, or how someone can contribute. Okay let me use myself as an example, I am an active contributor to the <a target="_blank" href="https://tailwindcss.com/">TailwindCSS</a> framework, aside from codes which I do contribute, I have written tutorials on it which include:</p>
<ul>
<li><a target="_blank" href="https://developeraspire.hashnode.dev/getting-started-with-tailwindcss-an-overview-and-walkthrough-tutorial">Getting Started with TailwindCSS - An Overview and Walkthrough Tutorial</a></li>
<li><a target="_blank" href="https://developeraspire.hashnode.dev/a-gentle-guide-to-customization-in-tailwindcss">A gentle guide to customization in TailwindCSS</a></li>
<li><a target="_blank" href="https://developeraspire.hashnode.dev/creating-customized-utility-and-components-classes-in-tailwindcss">Creating customized Utility and Components classes in TailwindCSS</a></li>
<li><a target="_blank" href="https://developeraspire.hashnode.dev/building-a-testimonial-card-with-tailwindcss">Building a testimonial card with TailwindCSS</a></li>
</ul>
</li>
</ul>
<p>And also an active contributor to <a target="_blank" href="https://golang.org/">Golang</a>, I have also written tutorials and articles, which you can find here on this blog. All these are aimed at contributing to the OSS.</p>
<ul>
<li><p><strong>Planning and organizing events and communities</strong> - You can also plan and host events and build communities to promote the usage of open source software and get more people to contribute. Some of those events and communities include forLoop Africa, OSCA, Gnome Africa e.t.c</p>
</li>
<li><p><strong>Designing</strong> - As a designer, you can contribute by proposing a new design to the software or adding new colors to the old one. There are many designers who are in the Open-source, if you are a designer reading this, yes there is so much room for you to join. We are waiting for you.</p>
</li>
<li><p><strong>Onboarding and helping new members</strong> - This is also a way, and again I will use myself as an example, am sure after reading this article you will be ready to make your own contribution, and yes I have onboarded you by writing this article for you, another one is my contributions to Go and TailwindCSS, through my articles, many people have started making use of it, and many ask me question concerning it. So can you see what onboarding means? You too can contribute in this way.</p>
</li>
<li><p><strong>Code reviews and mentoring</strong> - You can also contribute by reviewing the codebase by checking for bugs, quality of the code, errors, and checking if the best code practices are being followed.</p>
</li>
</ul>
<p>Many beginners make the mistake of jumping into the large codebase and start trying to understand it due to the misconception that they have been fed with, that contributions should be code alone which in turn leads to frustration. Even non-developers are scared to try due to this same misconception. But I think this article has highlighted some of the ways anybody can contribute without even knowing how to write code. So start small, but most importantly START!.</p>
<h2 id="making-your-first-contribution">Making your first contribution.</h2>
<p>Github as most of us know is an online place where we store our OSS codes, there is also a paid option for those who don't wish to make their code open-source. If you are ready to get started and make your first contribution or should I say pull request as the OSS community calls it, I have one beginner-friendly project you will like.</p>
<p>It is called Developers Fact Card, which means a website that contains facts, motivational quotes that can help a person in his/her career as a developer, writer, or designer in a card-like form. Do you have a motivational quote or fact about life that you need the world and the next generation to know? You can make a contribution to the project. The documentations are very simple and easy to understand, you don't need to be a super-coder to contribute as the project is geared towards beginners.  Below are the details:</p>
<ul>
<li><p>Github repo: <a target="_blank" href="https://github.com/DeveloperAspire/Developers-fact-card">Developers-fact-card</a></p>
</li>
<li><p>Live website: <a target="_blank" href="https://devfact.vercel.app/">Devfact card</a></p>
</li>
</ul>
<p>The maintainers are super friendly and you ask them for help if you get stuck along the way, everything you need to get started is explained in the documentation of the project. Get on board and make your contributions now!</p>
<h2 id="conclusion">Conclusion</h2>
<p>We have reached the end of this amazing article, did you finish your popcorn? or you didn't get one at all? Anyways, if you find this article helpful, like, comment and share, just do anything to make it get into the hands of many other beginners interested in Open-source.</p>
<p>I would be posting more articles, so be sure to follow me to get notified when I post them.</p>
<p>If you have any questions concerning Go, Javascript, TailwindCSS, Open-source, or this article? You can reach me on <a target="_blank" href="https://twitter.com/DeveloperAspire">Twitter</a>. Till next time, see ya. Thank you.</p>
]]></content:encoded></item><item><title><![CDATA[5 proven ways to increase your productivity as a Developer]]></title><description><![CDATA[Hello there, welcome back to my blog. Every developer go through burnout and stress, the worst and heartbreaking of all of them is not being productive…]]></description><link>https://developeraspire.hashnode.dev/5-proven-ways-to-increase-your-productivity-as-a-developer</link><guid isPermaLink="true">https://developeraspire.hashnode.dev/5-proven-ways-to-increase-your-productivity-as-a-developer</guid><category><![CDATA[Productivity]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[Web Development]]></category><dc:creator><![CDATA[Franklin Okolie]]></dc:creator><pubDate>Thu, 14 Jan 2021 13:49:09 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1610632088003/pDPI3qw2j.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="introduction">Introduction</h2>
<p>Hello there, welcome back to my blog. Every developer go through burnout and stress, the worst and heartbreaking of all of them is not being productive, you may be shipping a product or building something as small as a calculator, but being productive and been able to finish that task not just on time but also very well gives some sense of satisfaction. Most developers often complain of not being productive while some complain about how their productivity drops as the day goes by. In this article, we are going to learn 5 ways we can improve our productivity as a Developer.</p>
<h3 id="1-focus-on-one-thing-at-a-time">1. Focus on one thing at a time</h3>
<p>I mean it when I say it, most developers and human, in general, thinks being able to multitask and do million of things at the same time is what makes you productive. That is a big lie.</p>
<blockquote>
<p>What is the one thing you can do now, that by doing it every other thing will become easier or unnecessary? - <strong>Gray .W Keller</strong> author of The One thing</p>
</blockquote>
<p>By simply picking a task for a day and finishing it to the very end before moving to another is a proven way of being very productive. The same productivity is what the 80/20 rules talk about, what is that 20% task you can take that would produce 80% result, you just have to find it and focus on it for the rest of the day, weeks, or month as the case may be, then you can move to another task.</p>
<blockquote>
<p>Bit by bit, the bucket gets filled - <strong>Todd McLean</strong></p>
</blockquote>
<h2 id="2-break-your-task">2. Break your task</h2>
<p>Just like in programming, this applies to also our work. Break your task into a smaller unit and start small. If your task is to build a full video player application,  you can start breaking it down:</p>
<ul>
<li>Day1 - Brainstorm on the process.</li>
<li>Day2 - Make the HTML markup. e.t.c</li>
</ul>
<p>With this, you are able to keep track of your progress and become productive by achieving each task daily. Bombarding yourself with the whole process in one day can lead to mental stress, burnout, and fatigue which in turn can lead to depression when you are unable to meet this heavy task. So break it down!</p>
<h2 id="3-block-distracting-appswebsites">3. Block distracting apps/websites</h2>
<p>According to <a target="_blank" href="https://blog.rescuetime.com/communication-multitasking-switches/">research</a> carried out by RescueTime, the average digital worker can’t go more than 6 minutes without checking their email or instant messaging. The digital nature of our work and social lives leaves us constantly checking for notifications and this constant distraction hampers our ability to focus on tasks for even short periods of time.</p>
<p>This really has to change. To be very productive, developers need to minimize and control the amount of time they spend on other apps and websites.</p>
<p>There are a number of website and app blocker tools on the market and this is one of the key features in Serene, too. You create a list of apps and websites (you can block individual pages, too), which will automatically be blocked during work sessions. You can even prevent notifications from coming through during work hours and they’ll automatically come in once the session has finished.</p>
<h2 id="4-choose-your-tools-right">4. Choose your tools right</h2>
<p>As software engineers, we are bombarded daily with different tools from different angles, Javascript alone can boast of 10 frameworks for frontend development. Can you imagine? your job as a developer who wants productivity is to pick one of the many tools available that you are most comfortable with and use it, to avoid moving from one framework to another. The same applies to programming languages. I have heard about Bootstrap, Bulma, Materialize e.t.c but I choose to go for TailwindCSS, the one I am most comfortable with.</p>
<blockquote>
<p>It is essential to have good tools, but it is also essential that the tools should be used in the right way.  - <strong>Wallace .D. Wattles</strong></p>
<p>A good tool improves the way you work. A great tool improves the way you think. - <strong>Jeff Duntemann</strong></p>
</blockquote>
<h2 id="5-create-a-dedicated-workspace">5. Create a dedicated workspace.</h2>
<p>This one is crucial if you work from home or remotely. Don’t just sit on the couch or at the dinner table; create a dedicated workspace where you can go to work and then leave it once you’re done.</p>
<p> This also includes using the right hardware, for example, you can't learn and train a Machine learning model on a computer with an Intel Atom processor. Not that Intel Atom is a bad processor but it is not the right hardware for machine learning. So pick 
 the hardware that best suits your work and you are good to go.</p>
<h2 id="conclusion">Conclusion</h2>
<p>These are tested ways and I have used them in my work and I noticed some improvement from my end so I decided to share.</p>
<p>If you find this article useful, you can like, comment and share.
I would be posting more articles, so be sure to follow to get notified when I post them.</p>
<p>If you have any questions concerning Go, Javascript, TailwindCSS, Open-source, or this article? You can reach me on <a target="_blank" href="https://twitter.com/DeveloperAspire">Twitter</a>. Till next time, see ya. Thank you.</p>
]]></content:encoded></item><item><title><![CDATA[Building a testimonial card with TailwindCSS]]></title><description><![CDATA[Hello there, welcome back to my blog. The much-awaited project with TailwindCSS is here!! Horray! isn't that great?. In the last 3 articles of TailwindCSS…]]></description><link>https://developeraspire.hashnode.dev/building-a-testimonial-card-with-tailwindcss</link><guid isPermaLink="true">https://developeraspire.hashnode.dev/building-a-testimonial-card-with-tailwindcss</guid><category><![CDATA[Tailwind CSS]]></category><category><![CDATA[tailwind]]></category><category><![CDATA[Beginner Developers]]></category><category><![CDATA[Web Development]]></category><dc:creator><![CDATA[Franklin Okolie]]></dc:creator><pubDate>Thu, 14 Jan 2021 12:19:56 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1610618788992/6L-mFeMyF.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1610627078972/-uX4y9Uxz.png" alt="card-tailwind.png" /></p>
<h2 id="introduction">Introduction</h2>
<p>Hello there, welcome back to my blog. The much-awaited project with TailwindCSS is here!! Horray! isn't that great?. In the last 3 articles of TailwindCSS series, we discussed the fundamentals of Tailwind, it pro and cons, we discussed customization in TailwindCSS and we even went as far as making our own customized utility and custom classes in TailwindCSS. In this article you are going to learn:</p>
<ul>
<li>Mobile-first design.</li>
<li>Mobile responsiveness with TailwindCSS.</li>
<li>The usage of  different combination of utility classes</li>
</ul>
<blockquote>
<p>If this is your first time hearing about TailwindCSS, be sure to consume the following article and come back and join us here, we would be waiting for you: </p>
<ul>
<li><a target="_blank" href="https://developeraspire.hashnode.dev/getting-started-with-tailwindcss-an-overview-and-walkthrough-tutorial">Getting Started with TailwindCSS - An Overview and Walkthrough Tutorial</a></li>
<li><a target="_blank" href="https://developeraspire.hashnode.dev/a-gentle-guide-to-customization-in-tailwindcss">A gentle guide to customization in TailwindCSS</a></li>
<li><a target="_blank" href="https://developeraspire.hashnode.dev/creating-customized-utility-and-components-classes-in-tailwindcss">Creating customized Utility and Components classes in TailwindCSS</a></li>
</ul>
</blockquote>
<p>In this article, we are going to be building a testimonial card that bears our name, profession, and the amazing testimony you have about TailwindCSS. Here is mine below:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1610619460572/zpdEyZLJc.png" alt="card-tailwind.png" /></p>
<p> Is that lovely? I built it without writing any single CSS! just me and TailwindCSS, you are going to learn how to build yours, for the purpose of this article, I will rebuilding mine again with my preferred color, but on your end, I want you to twitch yours by adding your own color, a beautiful picture of you, your name and your profession, just as I did mine.</p>
<p>We are going to make use of <a target="_blank" href="https://play.tailwindcss.com/">Tailwind Playground</a>, and of course, you may choose to use an online environment you prefer, you may even use your code editor on your local machine and go through the learning process of installing Tailwind for this practice, as this would enforce what you have learned previously, you can use the installation guide on this <a target="_blank" href="https://developeraspire.hashnode.dev/getting-started-with-tailwindcss-an-overview-and-walkthrough-tutorial">article</a>. If you are going to use any other online code editor, you can check out <a target="_blank" href="https://codepen.io/">Codepen</a>. If you are using codepen, let me teach you how to add some settings that would allow you to use TailwindCSS. </p>
<ol>
<li>Open a pen, click on the <code>Settings</code> Tab.</li>
<li>Click on CSS, and scroll down to the <code>Add External Stylesheets/Pens</code>. </li>
<li><p>Then search for "TailwindCSS". Then click on it and Tailwind is now active in Codepen. Dust your palms.</p>
<p>The <a target="_blank" href="https://play.tailwindcss.com/">Tailwind Playground</a> already has Tailwind embedded, so you don't need any settings for it.</p>
</li>
</ol>
<h3 id="let-build">Let build!!!</h3>
<p>Now we are set to build, we must know that TailwindCSS is a framework that gives us the opportunity to use a  mobile-first 
 approach to designing anything we want, as that is the method we would use in this project. 
 First, let create a container <code>section</code> that would contain the whole items in the card.</p>
<pre><code><span class="hljs-tag">&lt;<span class="hljs-name">section</span> <span class="hljs-attr">class</span>= <span class="hljs-string">"pt-4 bg-white rounded-xl shadow mx-auto my-10 w-4/5"</span>&gt;</span>

<span class="hljs-tag">&lt;/<span class="hljs-name">section</span>&gt;</span>
</code></pre><p>So what did we do above?. We gave the container a <code>padding-top</code> of 4, then a background of white, a border-radius using TailwindCSS class <code>rounded-xl</code> which is equal to <code>0.75rem</code>, added shadow to the card, an <code>mx-auto</code> which means margin on the x-axis(left and right) making it centered on the page, included is also a margin-top of 10 to push it down the page. Then we added a width of <code>w-4/5</code> which is a Tailwind class for a width equal to 80%. Done? Good. </p>
<p>Now, inside the <code>section</code> we are going to create a <code>blockquote</code> to hold our testimonial statement.</p>
<pre><code>&lt;section <span class="hljs-keyword">class</span>= <span class="hljs-string">"pt-4 bg-white rounded-xl shadow mx-auto my-10 w-4/5"</span>&gt;
&lt;blockquote <span class="hljs-keyword">class</span>=<span class="hljs-string">"m-8"</span>&gt;
    &lt;p <span class="hljs-keyword">class</span>= <span class="hljs-string">"font-semibold"</span>&gt; <span class="hljs-string">"I had no design skills prior to using TailwindCSS, but with this amazing tools, I got better at CSS and design in general, it is an amazing tool"</span> &lt;/p&gt;
  &lt;/blockquote&gt;

&lt;/section&gt;
</code></pre><p>We added a margin of 8 on all sides of our <code>blockquote</code>, and we made our testimonial statement <code>semi-bold</code> with the class <code>font-semi-bold</code>. At this time your card should look like this :</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1610622044290/em9NAtQRw.png" alt="half-card.png" />
We are doing great!!!. Now let move to the part that contains our name, photo, and profession. We are going to create a <code>div</code> to wrap the image and our name + profession.</p>
<pre><code>&lt;section <span class="hljs-keyword">class</span>= <span class="hljs-string">"pt-4 bg-white rounded-xl shadow mx-auto my-10 w-4/5"</span>&gt;

&lt;blockquote <span class="hljs-keyword">class</span>=<span class="hljs-string">"m-8"</span>&gt;
    &lt;p <span class="hljs-keyword">class</span>= <span class="hljs-string">"font-semibold"</span>&gt; <span class="hljs-string">"I had no design skills prior to using TailwindCSS, but with this amazing tools, I got better at CSS and design in general, it is an amazing tool"</span> &lt;/p&gt;
  &lt;/blockquote&gt;


 &lt;div <span class="hljs-keyword">class</span>= <span class="hljs-string">"text-white bg-pink-600 p-8 rounded-b-xl"</span>&gt;

    &lt;/div&gt;

&lt;/section&gt;
</code></pre><p>The <code>div</code> has a background color of pink with a density of 600, with the text of color white, padding of 8 on all sides, a rounded bottom (border-radius of 0.75rem), you can use any background color of your choice.</p>
<p>Now let add a photo and text which is our name and profession. I am going to be using a picture from <a target="_blank" href="https://unsplash.com/">Unsplash</a>.</p>
<pre><code>&lt;section <span class="hljs-class"><span class="hljs-keyword">class</span></span>= <span class="hljs-string">"pt-4 bg-white rounded-xl shadow mx-auto my-10 w-4/5"</span>&gt;

<span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">blockquote</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"m-8"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">p</span> <span class="hljs-attr">class</span>= <span class="hljs-string">"font-semibold"</span>&gt;</span> "I had no design skills prior to using TailwindCSS, but with this amazing tools, I got better at CSS and design in general, it is an amazing tool" <span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">blockquote</span>&gt;</span></span>


 <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">class</span>= <span class="hljs-string">"text-white bg-pink-600 p-8 rounded-b-xl"</span>&gt;</span>

     <span class="hljs-tag">&lt;<span class="hljs-name">img</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"https://images.unsplash.com/photo-1591258739299-5b65d5cbb235?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&amp;ixlib=rb-1.2.1&amp;auto=format&amp;fit=crop&amp;w=634&amp;q=80"</span> <span class="hljs-attr">alt</span>=<span class="hljs-string">""</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"w-24 h-24 rounded-full border-4 border-white "</span> &gt;</span>

     <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
       <span class="hljs-tag">&lt;<span class="hljs-name">p</span> <span class="hljs-attr">class</span>= <span class="hljs-string">"font-bold"</span>&gt;</span> Franklin Okolie<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
       <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span> Software Engineer<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
     <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>

<span class="hljs-tag">&lt;/<span class="hljs-name">section</span>&gt;</span></span>
</code></pre><p>Our image has a class of <code>w-24</code> which means a width of 6rem and <code>h-24</code> for a height of 6rem also. We made it a <code>rounded-full</code> to make it a circle, and a white border around it, I also wrapped my name + profession in a <code>div</code> to make the code neat and readable. Now your card should look like this : </p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1610623430433/rx33Kvqrq.png" alt="desk-card.png" />
Horray! We can dust our palms and move on, but we need to add some more styles to make it presentable on desktop, the styles above will by default apply for desktop screens even as we used a mobile-first approach. On the <code>section</code> we are going to add the following:</p>
<pre><code>&lt;section <span class="hljs-class"><span class="hljs-keyword">class</span>= "<span class="hljs-title">pt</span>-4 <span class="hljs-title">bg</span>-<span class="hljs-title">white</span> <span class="hljs-title">rounded</span>-<span class="hljs-title">xl</span> <span class="hljs-title">shadow</span> <span class="hljs-title">mx</span>-<span class="hljs-title">auto</span> <span class="hljs-title">my</span>-10 <span class="hljs-title">w</span>-4/5 <span class="hljs-title">md</span>:<span class="hljs-type">w-3/5"&gt;</span></span>
&lt;/section&gt;
</code></pre><p>We just added <code>md:w-3/5</code> which means for medium screens and above, the width of the section should be <code>w-3/5</code> which is equal to 60% width. On our <code>div</code> holding the image and the text, we want on the medium screen and above the image and our name + profession to stay side by side. So we can add a flexbox style and center it :</p>
<pre><code>&lt;div <span class="hljs-class"><span class="hljs-keyword">class</span>= "<span class="hljs-title">text</span>-<span class="hljs-title">white</span> <span class="hljs-title">bg</span>-<span class="hljs-title">pink</span>-600 <span class="hljs-title">p</span>-8 <span class="hljs-title">rounded</span>-<span class="hljs-title">b</span>-<span class="hljs-title">xl</span> <span class="hljs-title">md</span>:<span class="hljs-type">flex md:items-center"&gt;</span></span>
&lt;/div&gt;
</code></pre><p>For our Image, let give it a margin-right on the medium screen to push away from the name+ profession:</p>
<pre><code>  &lt;img src=<span class="hljs-string">"https://images.unsplash.com/photo-1591258739299-5b65d5cbb235?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&amp;ixlib=rb-1.2.1&amp;auto=format&amp;fit=crop&amp;w=634&amp;q=80"</span> alt=<span class="hljs-string">""</span> <span class="hljs-class"><span class="hljs-keyword">class</span>="<span class="hljs-title">w</span>-24 <span class="hljs-title">h</span>-24 <span class="hljs-title">rounded</span>-<span class="hljs-title">full</span> <span class="hljs-title">border</span>-4 <span class="hljs-title">border</span>-<span class="hljs-title">white</span> <span class="hljs-title">md</span>:<span class="hljs-type">mr-4"&gt;</span></span>
</code></pre><p>And we are done!!!. Our card is set and super responsive on all screens from mobile to desktop. Isn't that sweet? we did all of that without writing any single CSS! This should be the number 8 wonder of the world.</p>
<h2 id="conclusion">Conclusion</h2>
<p>I hope you enjoyed this article, I really can't wait to see your testimonial card, can you show me in the comment section?. I have some more to show you. </p>
<ul>
<li><p>My Tailwind testimonial card <a target="_blank" href="https://play.tailwindcss.com/AfktO7aGbO">here</a></p>
</li>
<li><p>More cards of my codepen <a target="_blank" href="https://codepen.io/FranklinDev/pen/eYdKVPN">here</a></p>
</li>
</ul>
<p>Tell me if they are beautiful. More articles on TailwindCSS and other topics are coming, so follow to get notified when I publish it. If you find this article useful, share, like, and comment.</p>
<p>If you have any questions concerning Go, Javascript, TailwindCSS, Open-source, or this article? You can reach me on <a target="_blank" href="https://twitter.com/DeveloperAspire">Twitter</a> here. Till next time, see ya. Thank you.</p>
]]></content:encoded></item></channel></rss>